Use name of mentioned person in plain text

This commit is contained in:
Benjamin Neff 2017-01-29 01:45:32 +01:00
parent 322f92110a
commit 0e89d60117
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
2 changed files with 13 additions and 1 deletions

View file

@ -79,7 +79,7 @@ module Diaspora
end end
def make_mentions_plain_text def make_mentions_plain_text
@message = Diaspora::Mentionable.format message, [], plain_text: true @message = Diaspora::Mentionable.format message, options[:mentioned_people], plain_text: true
end end
def render_tags def render_tags

View file

@ -191,6 +191,18 @@ describe Diaspora::MessageRenderer do
text = "#hashtag message" text = "#hashtag message"
expect(message(text).plain_text_without_markdown).to eq text expect(message(text).plain_text_without_markdown).to eq text
end end
context "with mention" do
it "contains the name of the mentioned person" do
msg = message("@{#{alice.diaspora_handle}} is cool", mentioned_people: alice.person)
expect(msg.plain_text_without_markdown).to eq "#{alice.name} is cool"
end
it "uses the name from mention when the mention contains a name" do
msg = message("@{Alice; #{alice.diaspora_handle}} is cool", mentioned_people: alice.person)
expect(msg.plain_text_without_markdown).to eq "Alice is cool"
end
end
end end
describe "#urls" do describe "#urls" do