* Change move handler to carry blocks and mutes over When user A blocks user B and B moves to a new account C, make A block C accordingly. Note that it only works if A's instance is aware of the Move, that is, if B is on A's instance or has followers there. * Also notify instances with known people blocking you when moving * Add automatic account notes when blocking/muting an account that had no note
33 lines
868 B
Ruby
33 lines
868 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ActivityPub::MoveDistributionWorker
|
|
include Sidekiq::Worker
|
|
include Payloadable
|
|
|
|
sidekiq_options queue: 'push'
|
|
|
|
def perform(migration_id)
|
|
@migration = AccountMigration.find(migration_id)
|
|
@account = @migration.account
|
|
|
|
ActivityPub::DeliveryWorker.push_bulk(inboxes) do |inbox_url|
|
|
[signed_payload, @account.id, inbox_url]
|
|
end
|
|
|
|
ActivityPub::DeliveryWorker.push_bulk(Relay.enabled.pluck(:inbox_url)) do |inbox_url|
|
|
[signed_payload, @account.id, inbox_url]
|
|
end
|
|
rescue ActiveRecord::RecordNotFound
|
|
true
|
|
end
|
|
|
|
private
|
|
|
|
def inboxes
|
|
@inboxes ||= (@migration.account.followers.inboxes + @migration.account.blocked_by.inboxes).uniq
|
|
end
|
|
|
|
def signed_payload
|
|
@signed_payload ||= Oj.dump(serialize_payload(@migration, ActivityPub::MoveSerializer, signer: @account))
|
|
end
|
|
end
|