From 580b91c38740620488816755a5ccb2ec16ff8b1c Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 19 Mar 2016 00:02:39 +0100 Subject: [PATCH] Fix more subtle bugs with first_or_create --- app/services/process_interaction_service.rb | 2 +- app/services/process_mentions_service.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/process_interaction_service.rb b/app/services/process_interaction_service.rb index 43c8ca4fde..cdc7200839 100644 --- a/app/services/process_interaction_service.rb +++ b/app/services/process_interaction_service.rb @@ -62,7 +62,7 @@ class ProcessInteractionService < BaseService end def favourite!(xml, from_account) - status(xml).favourites.first_or_create!(account: from_account) + status(xml).favourites.where(account: from_account).first_or_create!(account: from_account) end def add_post!(body, account) diff --git a/app/services/process_mentions_service.rb b/app/services/process_mentions_service.rb index 760fdcf15d..6e92d16b45 100644 --- a/app/services/process_mentions_service.rb +++ b/app/services/process_mentions_service.rb @@ -14,7 +14,7 @@ class ProcessMentionsService < BaseService mentioned_account = follow_remote_account_service.("#{match.first}") end - mentioned_account.mentions.first_or_create(status: status) + mentioned_account.mentions.where(status: status).first_or_create(status: status) end status.mentions.each do |mentioned_account|