]> cat aescling's git repositories - mastodon.git/commitdiff
Deduplicate delete salmons (send only one per mentioned-account domain)
authorEugen Rochko <eugen@zeonfederated.com>
Sun, 12 Feb 2017 00:38:29 +0000 (01:38 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 12 Feb 2017 16:30:15 +0000 (17:30 +0100)
app/services/remove_status_service.rb

index b1a646b14530c496da2e4ef999e9fd72d56e7fff..73b545f170bdee214d292d248b348c090776c0fa 100644 (file)
@@ -32,12 +32,16 @@ class RemoveStatusService < BaseService
   end
 
   def remove_from_mentioned(status)
+    notified_domains = []
+
     status.mentions.each do |mention|
       mentioned_account = mention.account
 
       if mentioned_account.local?
         unpush(:mentions, mentioned_account, status)
       else
+        next if notified_domains.include?(mentioned_account.domain)
+        notified_domains << mentioned_account.domain
         send_delete_salmon(mentioned_account, status)
       end
     end