diff --git a/lib/diaspora/message_renderer.rb b/lib/diaspora/message_renderer.rb index de616f3d9..9540db631 100644 --- a/lib/diaspora/message_renderer.rb +++ b/lib/diaspora/message_renderer.rb @@ -79,7 +79,7 @@ module Diaspora end 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 def render_tags diff --git a/spec/lib/diaspora/message_renderer_spec.rb b/spec/lib/diaspora/message_renderer_spec.rb index fa0aa3b3b..539edec2b 100644 --- a/spec/lib/diaspora/message_renderer_spec.rb +++ b/spec/lib/diaspora/message_renderer_spec.rb @@ -191,6 +191,18 @@ describe Diaspora::MessageRenderer do text = "#hashtag message" expect(message(text).plain_text_without_markdown).to eq text 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 describe "#urls" do