Skip to content
Extraits de code Groupes Projets
Valider e3a95d7d rédigé par Jonne Haß's avatar Jonne Haß Validation de GitHub
Parcourir les fichiers

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

only create mentions after creating statusmessages
parents c74a7041 fb318373
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -58,7 +58,6 @@ class StatusMessage < Post ...@@ -58,7 +58,6 @@ class StatusMessage < Post
def mentioned_people def mentioned_people
if self.persisted? if self.persisted?
create_mentions if self.mentions.empty?
self.mentions.includes(:person => :profile).map{ |mention| mention.person } self.mentions.includes(:person => :profile).map{ |mention| mention.person }
else else
Diaspora::Mentionable.people_from_string(text) Diaspora::Mentionable.people_from_string(text)
......
...@@ -160,15 +160,16 @@ describe StatusMessage, type: :model do ...@@ -160,15 +160,16 @@ describe StatusMessage, type: :model do
end end
describe "#mentioned_people" do 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 status_message.mentions.delete_all
expect(status_message).to receive(:create_mentions) expect(status_message).not_to receive(:create_mentions)
status_message.mentioned_people status_message.mentioned_people
end end
it "returns the mentioned people" do it "returns the mentioned people" do
status_message.mentions.delete_all
expect(status_message.mentioned_people.to_set).to eq(people.to_set) expect(status_message.mentioned_people.to_set).to eq(people.to_set)
end end
it "does not call create_mentions if there are mentions in the db" do it "does not call create_mentions if there are mentions in the db" do
expect(status_message).not_to receive(:create_mentions) expect(status_message).not_to receive(:create_mentions)
status_message.mentioned_people status_message.mentioned_people
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter