mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-29 12:03:57 +00:00
a29a982eaa
* Change e-mail domain blocks to block IPs dynamically * Update app/workers/scheduler/email_domain_block_refresh_scheduler.rb Co-authored-by: Yamagishi Kazutoshi <ykzts@desire.sh> * Update app/workers/scheduler/email_domain_block_refresh_scheduler.rb Co-authored-by: Yamagishi Kazutoshi <ykzts@desire.sh> Co-authored-by: Yamagishi Kazutoshi <ykzts@desire.sh>
31 lines
626 B
Ruby
31 lines
626 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Form::EmailDomainBlockBatch
|
|
include ActiveModel::Model
|
|
include Authorization
|
|
include AccountableConcern
|
|
|
|
attr_accessor :email_domain_block_ids, :action, :current_account
|
|
|
|
def save
|
|
case action
|
|
when 'delete'
|
|
delete!
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def email_domain_blocks
|
|
@email_domain_blocks ||= EmailDomainBlock.where(id: email_domain_block_ids)
|
|
end
|
|
|
|
def delete!
|
|
email_domain_blocks.each do |email_domain_block|
|
|
authorize(email_domain_block, :destroy?)
|
|
email_domain_block.destroy!
|
|
log_action :destroy, email_domain_block
|
|
end
|
|
end
|
|
end
|