1
0
mirror of https://github.com/mastodon/mastodon synced 2024-11-28 14:58:21 +09:00

Deduplicate delete salmons (send only one per mentioned-account domain)

This commit is contained in:
Eugen Rochko 2017-02-12 01:38:29 +01:00
parent 78b3b52663
commit 446267d1bf

View File

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