Fix domain hiding logic (#7765)
* Send rejections to followers when user hides domain they're on * Use account domain blocks for "authorized followers" action Replace soft-blocking (block & unblock) behaviour with follow rejection * Split sync and async work of account domain blocking Do not create domain block when removing followers by domain, that is probably unexpected from the user's perspective. * Adjust confirmation message for domain block * yarn manage:translations
This commit is contained in:
11
app/workers/after_account_domain_block_worker.rb
Normal file
11
app/workers/after_account_domain_block_worker.rb
Normal file
@ -0,0 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AfterAccountDomainBlockWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
def perform(account_id, domain)
|
||||
AfterBlockDomainFromAccountService.new.call(Account.find(account_id), domain)
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
end
|
@ -1,14 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class SoftBlockDomainFollowersWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'pull'
|
||||
|
||||
def perform(account_id, domain)
|
||||
followers_id = Account.find(account_id).followers.where(domain: domain).pluck(:id)
|
||||
SoftBlockWorker.push_bulk(followers_id) do |follower_id|
|
||||
[account_id, follower_id]
|
||||
end
|
||||
end
|
||||
end
|
@ -1,17 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class SoftBlockWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'pull'
|
||||
|
||||
def perform(account_id, target_account_id)
|
||||
account = Account.find(account_id)
|
||||
target_account = Account.find(target_account_id)
|
||||
|
||||
BlockService.new.call(account, target_account)
|
||||
UnblockService.new.call(account, target_account)
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user