Add skip_* methods to check move worker process (#35538)

This commit is contained in:
Matt Jankowski 2025-07-28 04:50:19 -04:00 committed by GitHub
parent 456c3bda0b
commit 86ef4d4884
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -104,7 +104,7 @@ class MoveWorker
def carry_blocks_over! def carry_blocks_over!
@source_account.blocked_by_relationships.where(account: Account.local).find_each do |block| @source_account.blocked_by_relationships.where(account: Account.local).find_each do |block|
unless block.account.blocking?(@target_account) || block.account.following?(@target_account) unless skip_block_move?(block)
BlockService.new.call(block.account, @target_account) BlockService.new.call(block.account, @target_account)
add_account_note_if_needed!(block.account, 'move_handler.carry_blocks_over_text') add_account_note_if_needed!(block.account, 'move_handler.carry_blocks_over_text')
end end
@ -115,7 +115,7 @@ class MoveWorker
def carry_mutes_over! def carry_mutes_over!
@source_account.muted_by_relationships.where(account: Account.local).find_each do |mute| @source_account.muted_by_relationships.where(account: Account.local).find_each do |mute|
MuteService.new.call(mute.account, @target_account, notifications: mute.hide_notifications) unless mute.account.muting?(@target_account) || mute.account.following?(@target_account) MuteService.new.call(mute.account, @target_account, notifications: mute.hide_notifications) unless skip_mute_move?(mute)
add_account_note_if_needed!(mute.account, 'move_handler.carry_mutes_over_text') add_account_note_if_needed!(mute.account, 'move_handler.carry_mutes_over_text')
rescue => e rescue => e
@deferred_error = e @deferred_error = e
@ -130,4 +130,12 @@ class MoveWorker
AccountNote.create!(account: account, target_account: @target_account, comment: text) AccountNote.create!(account: account, target_account: @target_account, comment: text)
end end
end end
def skip_mute_move?(mute)
mute.account.muting?(@target_account) || mute.account.following?(@target_account)
end
def skip_block_move?(block)
block.account.blocking?(@target_account) || block.account.following?(@target_account)
end
end end