Commit e3a95d7d authored by Jonne Haß's avatar Jonne Haß Committed by GitHub

Merge pull request #6995 from SuperTux88/fix-mention-fetching

only create mentions after creating statusmessages
parents c74a7041 fb318373
......@@ -58,7 +58,6 @@ class StatusMessage < Post
def mentioned_people
if self.persisted?
create_mentions if self.mentions.empty?
self.mentions.includes(:person => :profile).map{ |mention| mention.person }
else
Diaspora::Mentionable.people_from_string(text)
......
......@@ -160,15 +160,16 @@ describe StatusMessage, type: :model do
end
describe "#mentioned_people" do
it "calls create_mentions if there are no mentions in the db" do
it "does not call create_mentions if there are no mentions in the db" do
status_message.mentions.delete_all
expect(status_message).to receive(:create_mentions)
expect(status_message).not_to receive(:create_mentions)
status_message.mentioned_people
end
it "returns the mentioned people" do
status_message.mentions.delete_all
expect(status_message.mentioned_people.to_set).to eq(people.to_set)
end
it "does not call create_mentions if there are mentions in the db" do
expect(status_message).not_to receive(:create_mentions)
status_message.mentioned_people
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment