Adding domain blocks
This commit is contained in:
parent
52d7f862d3
commit
22a8801dbc
13 changed files with 92 additions and 10 deletions
13
app/services/block_domain_service.rb
Normal file
13
app/services/block_domain_service.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
class BlockDomainService < BaseService
|
||||
def call(domain)
|
||||
block = DomainBlock.find_or_create_by!(domain: domain)
|
||||
|
||||
Account.where(domain: domain).find_each do |account|
|
||||
if account.subscribed?
|
||||
account.subscription('').unsubscribe
|
||||
end
|
||||
|
||||
account.destroy!
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue