From 939a47393cf7b65bca9fa7817fcc2dbae770cb9c Mon Sep 17 00:00:00 2001
From: Takeshi Umeda <noel.yoshiba@gmail.com>
Date: Thu, 23 Jul 2020 22:41:49 +0900
Subject: Fix duplicate notification and delivery of mentions (#14378)

---
 app/services/process_mentions_service.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'app')

diff --git a/app/services/process_mentions_service.rb b/app/services/process_mentions_service.rb
index 3822b7dc5..79af3fc54 100644
--- a/app/services/process_mentions_service.rb
+++ b/app/services/process_mentions_service.rb
@@ -36,7 +36,8 @@ class ProcessMentionsService < BaseService
 
       next match if mention_undeliverable?(mentioned_account) || mentioned_account&.suspended?
 
-      mentions << mentioned_account.mentions.where(status: status).first_or_create(status: status)
+      mention = mentioned_account.mentions.new(status: status)
+      mentions << mention if mention.save
 
       "@#{mentioned_account.acct}"
     end
-- 
cgit