mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-30 07:29:03 +01:00
a60d9335d8
* Fix ResolveAccountService accepting mismatching acct: URI * Set attributes that should be updated regardless of suspension * Fix key fetching * Automatically merge remote accounts with duplicate `uri` * Add tests * Add "tootctl accounts fix-duplicates" Finds duplicate accounts sharing a same ActivityPub `id`, re-fetch them and merge them under the canonical `acct:` URI. Co-authored-by: Claire <claire.github-309c@sitedethib.com>
18 lines
401 B
Ruby
18 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
|