mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-16 20:03:24 +00:00
19 lines
401 B
Ruby
19 lines
401 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
class AccountMergingWorker
|
||
|
include Sidekiq::Worker
|
||
|
|
||
|
sidekiq_options queue: 'pull'
|
||
|
|
||
|
def perform(account_id)
|
||
|
account = Account.find(account_id)
|
||
|
|
||
|
return true if account.nil? || account.local?
|
||
|
|
||
|
Account.where(uri: account.uri).where.not(id: account.id).find_each do |duplicate|
|
||
|
account.merge_with!(duplicate)
|
||
|
duplicate.destroy
|
||
|
end
|
||
|
end
|
||
|
end
|