gearheads
/
mastodon
Archived
2
0
Fork 0
This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
mastodon/app/workers/account_merging_worker.rb

19 lines
401 B
Ruby
Raw Normal View History

# 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