Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
diaspora
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
diasporg
diaspora
Commits
066f8d12
Commit
066f8d12
authored
Oct 31, 2011
by
Dan Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mention the person who invited a user on first message
parent
3118f7a0
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
63 additions
and
13 deletions
+63
-13
app/helpers/interim_stream_hackiness_helper.rb
app/helpers/interim_stream_hackiness_helper.rb
+12
-2
app/views/shared/_publisher.html.haml
app/views/shared/_publisher.html.haml
+2
-2
config/locales/diaspora/en.yml
config/locales/diaspora/en.yml
+2
-1
lib/publisher.rb
lib/publisher.rb
+15
-3
lib/stream/multi.rb
lib/stream/multi.rb
+5
-0
public/javascripts/publisher.js
public/javascripts/publisher.js
+4
-1
spec/lib/publisher_spec.rb
spec/lib/publisher_spec.rb
+7
-2
spec/lib/stream/multi_spec.rb
spec/lib/stream/multi_spec.rb
+16
-2
No files found.
app/helpers/interim_stream_hackiness_helper.rb
View file @
066f8d12
...
...
@@ -11,7 +11,17 @@ module InterimStreamHackinessHelper
end
##### These methods need to go away once we pass publisher object into the partial ######
def
publisher_prefill_text
def
publisher_formatted_text
if
params
[
:prefill
].
present?
params
[
:prefill
]
elsif
defined?
(
@stream
)
@stream
.
publisher
.
text
else
nil
end
end
def
publisher_hidden_text
if
params
[
:prefill
].
present?
params
[
:prefill
]
elsif
defined?
(
@stream
)
...
...
app/views/shared/_publisher.html.haml
View file @
066f8d12
...
...
@@ -56,9 +56,9 @@
#publisher_textarea_wrapper
=
link_to
(
image_tag
(
'deletelabel.png'
),
"#"
,
:id
=>
"hide_publisher"
,
:title
=>
t
(
'.discard_post'
))
%ul
#photodropzone
=
status
.
text_area
:fake_text
,
:rows
=>
2
,
:value
=>
h
(
publisher_
prefill
_text
),
:tabindex
=>
1
,
:placeholder
=>
t
(
'.whats_on_your_mind'
),
=
status
.
text_area
:fake_text
,
:rows
=>
2
,
:value
=>
h
(
publisher_
formatted
_text
),
:tabindex
=>
1
,
:placeholder
=>
t
(
'.whats_on_your_mind'
),
:title
=>
"1.
#{
t
(
'shared.public_explain.share'
)
}
"
,
'data-content'
=>
t
(
'shared.public_explain.new_user_welcome_message'
)
=
status
.
hidden_field
:text
,
:value
=>
''
,
:class
=>
'clear_on_submit'
=
status
.
hidden_field
:text
,
:value
=>
h
(
publisher_hidden_text
)
,
:class
=>
'clear_on_submit'
#file-upload
{
:title
=>
t
(
'.upload_photos'
)}
=
image_tag
'icons/camera.svg'
,
:height
=>
14
...
...
config/locales/diaspora/en.yml
View file @
066f8d12
...
...
@@ -742,7 +742,8 @@ en:
discard_post
:
"
Discard
post"
new_user_prefill
:
hello
:
"
Hey
everyone,
I'm
#%{new_user_tag}.
"
i_like
:
"
I'm
interested
in
%{tags}."
i_like
:
"
I'm
interested
in
%{tags}.
"
invited_by
:
"
Thanks
for
the
invite,
"
add_contact
:
enter_a_diaspora_username
:
"
Enter
a
Diaspora
username:"
your_diaspora_username_is
:
"
Your
Diaspora
username
is:
%{diaspora_handle}"
...
...
lib/publisher.rb
View file @
066f8d12
...
...
@@ -3,10 +3,14 @@ class Publisher
def
initialize
(
user
,
opts
=
{})
self
.
user
=
user
self
.
open
=
(
opts
[
:open
]
==
true
)?
true
:
false
self
.
open
=
opts
[
:open
]
self
.
prefill
=
opts
[
:prefill
]
self
.
public
=
(
opts
[
:public
]
==
true
)?
true
:
false
self
.
explain
=
(
opts
[
:explain
]
==
true
)?
true
:
false
self
.
public
=
opts
[
:public
]
self
.
explain
=
opts
[
:explain
]
end
def
text
formatted_message
end
def
open?
...
...
@@ -20,4 +24,12 @@ class Publisher
def
explain?
self
.
explain
end
private
def
formatted_message
if
self
.
prefill
.
present?
StatusMessage
.
new
(
:text
=>
self
.
prefill
).
format_mentions
(
self
.
prefill
,
:plain_text
=>
true
)
end
end
end
lib/stream/multi.rb
View file @
066f8d12
...
...
@@ -55,6 +55,11 @@ class Stream::Multi < Stream::Base
prefill
<<
I18n
.
t
(
"shared.publisher.new_user_prefill.i_like"
,
:tags
=>
tag_string
)
end
if
inviter
=
self
.
user
.
invited_by
.
try
(
:person
)
prefill
<<
I18n
.
t
(
"shared.publisher.new_user_prefill.invited_by"
)
prefill
<<
"@{
#{
inviter
.
name
}
;
#{
inviter
.
diaspora_handle
}
}!"
end
prefill
end
...
...
public/javascripts/publisher.js
View file @
066f8d12
...
...
@@ -489,7 +489,10 @@ var Publisher = {
});
Publisher
.
autocompletion
.
initialize
();
if
(
Publisher
.
hiddenInput
().
val
()
===
""
)
{
Publisher
.
hiddenInput
().
val
(
Publisher
.
input
().
val
());
}
Publisher
.
input
().
autoResize
();
Publisher
.
input
().
keydown
(
Publisher
.
autocompletion
.
keyDownHandler
);
Publisher
.
input
().
keyup
(
Publisher
.
autocompletion
.
keyUpHandler
);
...
...
spec/lib/publisher_spec.rb
View file @
066f8d12
...
...
@@ -9,8 +9,6 @@ describe Publisher do
@publisher
=
Publisher
.
new
(
alice
)
end
describe
"#prefill"
do
it
'defaults to nothing'
do
@publisher
.
prefill
.
should
be_blank
...
...
@@ -21,6 +19,13 @@ describe Publisher do
end
end
describe
'#text'
do
it
'is a formatted version of the prefill'
do
p
=
Publisher
.
new
(
alice
,
:prefill
=>
"@{ alice ; alice@pod.com }"
)
p
.
text
.
should
==
"alice"
end
end
[
"open"
,
"public"
,
"explain"
].
each
do
|
property
|
describe
"#
#{
property
}
?"
do
...
...
spec/lib/stream/multi_spec.rb
View file @
066f8d12
...
...
@@ -44,11 +44,25 @@ describe Stream::Multi do
end
it
'returns includes new user hashtag'
do
@stream
.
send
(
:publisher_prefill
).
include?
(
"#NewHere"
).
should
be_true
@stream
.
send
(
:publisher_prefill
).
should
include
(
"#NewHere"
)
end
it
'includes followed hashtags'
do
@stream
.
send
(
:publisher_prefill
).
include?
(
"#cats"
).
should
be_true
@stream
.
send
(
:publisher_prefill
).
should
include
(
"#cats"
)
end
context
'when invited by another user'
do
before
do
@user
=
Factory
(
:user
,
:invited_by
=>
alice
)
@inviter
=
alice
.
person
@stream
=
Stream
::
Multi
.
new
(
@user
)
end
it
'includes a mention of the inviter'
do
mention
=
"@{
#{
@inviter
.
name
}
;
#{
@inviter
.
diaspora_handle
}
}"
@stream
.
send
(
:publisher_prefill
).
should
include
(
mention
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment