Refactor domain_blocks_controller (#2843)
* Set domain_block by before_action * Cast value with ActiveRecord::Type * Batch update
This commit is contained in:
parent
2d45794956
commit
a0b1951791
3 changed files with 13 additions and 8 deletions
|
@ -3,10 +3,12 @@
|
|||
class UnblockDomainService < BaseService
|
||||
def call(domain_block, retroactive)
|
||||
if retroactive
|
||||
accounts = Account.where(domain: domain_block.domain).in_batches
|
||||
|
||||
if domain_block.silence?
|
||||
Account.where(domain: domain_block.domain).update_all(silenced: false)
|
||||
accounts.update_all(silenced: false)
|
||||
else
|
||||
Account.where(domain: domain_block.domain).update_all(suspended: false)
|
||||
accounts.update_all(suspended: false)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue