Render mentions as links in comments
This commit is contained in:
parent
99351bd152
commit
ef3faff8f1
3 changed files with 19 additions and 6 deletions
|
|
@ -20,7 +20,7 @@ app.views.Comment = app.views.Content.extend({
|
||||||
presenter : function() {
|
presenter : function() {
|
||||||
return _.extend(this.defaultPresenter(), {
|
return _.extend(this.defaultPresenter(), {
|
||||||
canRemove: this.canRemove(),
|
canRemove: this.canRemove(),
|
||||||
text : app.helpers.textFormatter(this.model.get("text"))
|
text: app.helpers.textFormatter(this.model.get("text"), this.model.get("mentioned_people"))
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,12 @@ class CommentPresenter < BasePresenter
|
||||||
|
|
||||||
def as_json(opts={})
|
def as_json(opts={})
|
||||||
{
|
{
|
||||||
:id => @comment.id,
|
id: @comment.id,
|
||||||
:guid => @comment.guid,
|
guid: @comment.guid,
|
||||||
:text => @comment.message.plain_text_for_json,
|
text: @comment.message.plain_text_for_json,
|
||||||
:author => @comment.author.as_api_response(:backbone),
|
author: @comment.author.as_api_response(:backbone),
|
||||||
:created_at => @comment.created_at
|
created_at: @comment.created_at,
|
||||||
|
mentioned_people: @comment.mentioned_people.as_api_response(:backbone)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -54,3 +54,15 @@ Feature: Mentions
|
||||||
Then I should see "Bob Jones" within ".stream-element"
|
Then I should see "Bob Jones" within ".stream-element"
|
||||||
When I follow "Bob Jones"
|
When I follow "Bob Jones"
|
||||||
Then I should see "Bob Jones"
|
Then I should see "Bob Jones"
|
||||||
|
|
||||||
|
Scenario: A user mentions another user in a comment and it displays correctly
|
||||||
|
Given following users exist:
|
||||||
|
| username | email |
|
||||||
|
| Bob Jones | bob@bob.bob |
|
||||||
|
| Alice Smith | alice@alice.alice |
|
||||||
|
And a user with email "bob@bob.bob" is connected with "alice@alice.alice"
|
||||||
|
And "alice@alice.alice" has a public post with text "check this out!"
|
||||||
|
And "alice@alice.alice" has commented mentioning "bob@bob.bob" on "check this out!"
|
||||||
|
When I sign in as "alice@alice.alice"
|
||||||
|
And I follow "Bob Jones"
|
||||||
|
Then I should see "Bob Jones"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue