ability to add domain moderation notes, edit existing domain policies in-place, and process asynchronously
parent
964054b6db
commit
80a81fe223
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class DomainBlocksController < BaseController
|
class DomainBlocksController < BaseController
|
||||||
before_action :set_domain_block, only: [:show, :destroy]
|
before_action :set_domain_block, only: [:show, :destroy, :update]
|
||||||
|
|
||||||
def new
|
def new
|
||||||
authorize :domain_block, :create?
|
authorize :domain_block, :create?
|
||||||
|
@ -15,23 +15,17 @@ module Admin
|
||||||
@domain_block = DomainBlock.new(resource_params)
|
@domain_block = DomainBlock.new(resource_params)
|
||||||
existing_domain_block = resource_params[:domain].present? ? DomainBlock.find_by(domain: resource_params[:domain]) : nil
|
existing_domain_block = resource_params[:domain].present? ? DomainBlock.find_by(domain: resource_params[:domain]) : nil
|
||||||
|
|
||||||
if existing_domain_block.present? && !@domain_block.stricter_than?(existing_domain_block)
|
if existing_domain_block.present?
|
||||||
@domain_block.save
|
@domain_block = existing_domain_block
|
||||||
flash[:alert] = I18n.t('admin.domain_blocks.existing_domain_block_html', name: existing_domain_block.domain, unblock_url: admin_domain_block_path(existing_domain_block)).html_safe # rubocop:disable Rails/OutputSafety
|
@domain_block.update(resource_params.except(:undo))
|
||||||
@domain_block.errors[:domain].clear
|
end
|
||||||
render :new
|
|
||||||
|
if @domain_block.save
|
||||||
|
DomainBlockWorker.perform_async(@domain_block.id)
|
||||||
|
log_action :create, @domain_block
|
||||||
|
redirect_to admin_instance_path(id: @domain_block.domain, limited: '1'), notice: I18n.t('admin.domain_blocks.created_msg')
|
||||||
else
|
else
|
||||||
if existing_domain_block.present?
|
render :new
|
||||||
@domain_block = existing_domain_block
|
|
||||||
@domain_block.update(resource_params)
|
|
||||||
end
|
|
||||||
if @domain_block.save
|
|
||||||
DomainBlockWorker.perform_async(@domain_block.id)
|
|
||||||
log_action :create, @domain_block
|
|
||||||
redirect_to admin_instances_path(limited: '1'), notice: I18n.t('admin.domain_blocks.created_msg')
|
|
||||||
else
|
|
||||||
render :new
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -41,9 +35,25 @@ module Admin
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
authorize @domain_block, :destroy?
|
authorize @domain_block, :destroy?
|
||||||
UnblockDomainService.new.call(@domain_block)
|
DomainUnblockWorker.perform_async(@domain_block.id)
|
||||||
log_action :destroy, @domain_block
|
log_action :destroy, @domain_block
|
||||||
redirect_to admin_instances_path(limited: '1'), notice: I18n.t('admin.domain_blocks.destroyed_msg')
|
flash[:notice] = I18n.t('admin.domain_blocks.destroyed_msg')
|
||||||
|
redirect_to controller: 'admin/instances', action: 'index', limited: '1'
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
return destroy unless resource_params[:undo].to_i.zero?
|
||||||
|
authorize @domain_block, :update?
|
||||||
|
@domain_block.update(resource_params.except(:domain, :undo))
|
||||||
|
changed = @domain_block.changed
|
||||||
|
if @domain_block.save
|
||||||
|
DomainBlockWorker.perform_async(@domain_block.id) if (changed & %w(severity force_sensitive reject_media)).any?
|
||||||
|
log_action :update, @domain_block
|
||||||
|
flash[:notice] = I18n.t('admin.domain_blocks.updated_msg')
|
||||||
|
else
|
||||||
|
flash[:alert] = I18n.t('admin.domain_blocks.update_failed_msg')
|
||||||
|
end
|
||||||
|
redirect_to admin_instance_path(id: @domain_block.domain, limited: '1')
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -53,7 +63,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def resource_params
|
def resource_params
|
||||||
params.require(:domain_block).permit(:domain, :severity, :force_sensitive, :reject_media, :reject_reports)
|
params.require(:domain_block).permit(:domain, :severity, :force_sensitive, :reject_media, :reject_reports, :reason, :undo)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -87,7 +87,7 @@ module Admin::ActionLogsHelper
|
||||||
when 'Report'
|
when 'Report'
|
||||||
link_to "##{record.id}", admin_report_path(record)
|
link_to "##{record.id}", admin_report_path(record)
|
||||||
when 'DomainBlock', 'EmailDomainBlock'
|
when 'DomainBlock', 'EmailDomainBlock'
|
||||||
link_to record.domain, "https://#{record.domain}"
|
link_to record.domain, admin_instance_path(id: record.domain)
|
||||||
when 'Status'
|
when 'Status'
|
||||||
link_to record.account.acct, TagManager.instance.url_for(record)
|
link_to record.account.acct, TagManager.instance.url_for(record)
|
||||||
when 'AccountWarning'
|
when 'AccountWarning'
|
||||||
|
@ -100,7 +100,7 @@ module Admin::ActionLogsHelper
|
||||||
when 'CustomEmoji'
|
when 'CustomEmoji'
|
||||||
attributes['shortcode']
|
attributes['shortcode']
|
||||||
when 'DomainBlock', 'EmailDomainBlock'
|
when 'DomainBlock', 'EmailDomainBlock'
|
||||||
link_to attributes['domain'], "https://#{attributes['domain']}"
|
link_to attributes['domain'], admin_instance_path(id: attributes['domain'])
|
||||||
when 'Status'
|
when 'Status'
|
||||||
tmp_status = Status.new(attributes.except('reblogs_count', 'favourites_count'))
|
tmp_status = Status.new(attributes.except('reblogs_count', 'favourites_count'))
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ module BangtagHelper
|
||||||
POLICIES = %w(silence unsilence suspend unsuspend force_unlisted allow_public force_sensitive allow_nonsensitive reset)
|
POLICIES = %w(silence unsilence suspend unsuspend force_unlisted allow_public force_sensitive allow_nonsensitive reset)
|
||||||
EXCLUDED_DOMAINS = %w(tailma.ws monsterpit.net monsterpit.cloud monsterpit.gallery monsterpit.blog)
|
EXCLUDED_DOMAINS = %w(tailma.ws monsterpit.net monsterpit.cloud monsterpit.gallery monsterpit.blog)
|
||||||
|
|
||||||
def account_policy(username, domain = nil, policy)
|
def account_policy(username, domain, policy, reason = nil)
|
||||||
return if policy.blank?
|
return if policy.blank?
|
||||||
policy = policy.to_s
|
policy = policy.to_s
|
||||||
return false unless policy.in?(POLICIES)
|
return false unless policy.in?(POLICIES)
|
||||||
|
@ -50,6 +50,14 @@ module BangtagHelper
|
||||||
|
|
||||||
acct.save
|
acct.save
|
||||||
|
|
||||||
|
return true unless reason && !reason.strip.blank?
|
||||||
|
|
||||||
|
AccountModerationNote.create(
|
||||||
|
account_id: @account.id,
|
||||||
|
target_account_id: acct.id,
|
||||||
|
content: reason.strip
|
||||||
|
)
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,7 +71,7 @@ module BangtagHelper
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def domain_policy(domain, policy, force_sensitive = false, reject_media = false, reject_reports = false)
|
def domain_policy(domain, policy, reason = nil, force_sensitive = false, reject_media = false, reject_reports = false)
|
||||||
return if policy.blank?
|
return if policy.blank?
|
||||||
policy = policy.to_s
|
policy = policy.to_s
|
||||||
return false unless policy.in?(POLICIES)
|
return false unless policy.in?(POLICIES)
|
||||||
|
@ -86,18 +94,19 @@ module BangtagHelper
|
||||||
domain_block.force_sensitive = force_sensitive
|
domain_block.force_sensitive = force_sensitive
|
||||||
domain_block.reject_media = reject_media
|
domain_block.reject_media = reject_media
|
||||||
domain_block.reject_reports = reject_reports
|
domain_block.reject_reports = reject_reports
|
||||||
|
domain_block.reason = reason.strip if reason && !reason.strip.blank?
|
||||||
domain_block.save
|
domain_block.save
|
||||||
|
|
||||||
Admin::ActionLog.create(account: @account, action: :create, target: domain_block)
|
Admin::ActionLog.create(account: @account, action: :create, target: domain_block)
|
||||||
user_friendly_action_log(@account, :create, domain_block)
|
user_friendly_action_log(@account, :create, domain_block)
|
||||||
BlockDomainService.new.call(domain_block)
|
DomainBlockWorker.perform_async(domain_block.id)
|
||||||
else
|
else
|
||||||
domain_block = DomainBlock.find_by(domain: domain)
|
domain_block = DomainBlock.find_by(domain: domain)
|
||||||
return false if domain_block.nil?
|
return false if domain_block.nil?
|
||||||
|
|
||||||
Admin::ActionLog.create(account: @account, action: :destroy, target: domain_block)
|
Admin::ActionLog.create(account: @account, action: :destroy, target: domain_block)
|
||||||
user_friendly_action_log(@account, :destroy, domain_block)
|
user_friendly_action_log(@account, :destroy, domain_block)
|
||||||
UnblockDomainService.new.call(domain_block)
|
DomainUnblockWorker.perform_async(domain_block.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
true
|
true
|
||||||
|
|
|
@ -7,7 +7,7 @@ module LogHelper
|
||||||
case action
|
case action
|
||||||
when :create
|
when :create
|
||||||
if target.is_a? DomainBlock
|
if target.is_a? DomainBlock
|
||||||
LogWorker.perform_async("\xf0\x9f\x9a\xab <#{source}> applied a #{target.severity}#{target.force_sensitive? ? " and force sensitive media" : ''}#{target.reject_media? ? " and reject media" : ''} policy on https://#{target.domain}\u200b.", LOG_SCOPE_MODERATION)
|
LogWorker.perform_async("\xf0\x9f\x9a\xab <#{source}> applied a #{target.severity}#{target.force_sensitive? ? " and force sensitive media" : ''}#{target.reject_media? ? " and reject media" : ''} policy on https://#{target.domain}\u200b.\n\n#{target.reason? ? "Comment: #{target.reason}" : ''}", LOG_SCOPE_MODERATION)
|
||||||
elsif target.is_a? EmailDomainBlock
|
elsif target.is_a? EmailDomainBlock
|
||||||
LogWorker.perform_async("\u26d4 <#{source}> added a registration block on email domain '#{target.domain}'.", LOG_SCOPE_MODERATION)
|
LogWorker.perform_async("\u26d4 <#{source}> added a registration block on email domain '#{target.domain}'.", LOG_SCOPE_MODERATION)
|
||||||
elsif target.is_a? CustomEmoji
|
elsif target.is_a? CustomEmoji
|
||||||
|
@ -27,7 +27,9 @@ module LogHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
when :update
|
when :update
|
||||||
if target.is_a? Status
|
if target.is_a? DomainBlock
|
||||||
|
LogWorker.perform_async("\xf0\x9f\x9a\xab <#{source}> changed the policy on https://#{target.domain} to #{target.severity}#{target.force_sensitive? ? " and force sensitive media" : ''}#{target.reject_media? ? " and reject media" : ''}.\n\n#{target.reason? ? "Comment: #{target.reason}" : ''}", LOG_SCOPE_MODERATION)
|
||||||
|
elsif target.is_a? Status
|
||||||
LogWorker.perform_async("\xf0\x9f\x91\x81\xef\xb8\x8f <#{source}> changed visibility flags of post #{TagManager.instance.url_for(target)}\u200b.", LOG_SCOPE_MODERATION)
|
LogWorker.perform_async("\xf0\x9f\x91\x81\xef\xb8\x8f <#{source}> changed visibility flags of post #{TagManager.instance.url_for(target)}\u200b.", LOG_SCOPE_MODERATION)
|
||||||
elsif target.is_a? CustomEmoji
|
elsif target.is_a? CustomEmoji
|
||||||
LogWorker.perform_async("\xf0\x9f\x94\x81 <#{source}> replaced the '#{target.shortcode}' emoji. :#{target.shortcode}:", LOG_SCOPE_MODERATION)
|
LogWorker.perform_async("\xf0\x9f\x94\x81 <#{source}> replaced the '#{target.shortcode}' emoji. :#{target.shortcode}:", LOG_SCOPE_MODERATION)
|
||||||
|
|
|
@ -744,12 +744,13 @@ class Bangtags
|
||||||
end
|
end
|
||||||
when 'silence', 'unsilence', 'suspend', 'unsuspend', 'force_unlisted', 'allow_public', 'force_sensitive', 'allow_nonsensitive', 'reset', 'forgive'
|
when 'silence', 'unsilence', 'suspend', 'unsuspend', 'force_unlisted', 'allow_public', 'force_sensitive', 'allow_nonsensitive', 'reset', 'forgive'
|
||||||
action = 'reset' if action == 'forgive'
|
action = 'reset' if action == 'forgive'
|
||||||
|
reason = tf_cmd[2..-1].join(':')
|
||||||
chunk.split.each do |c|
|
chunk.split.each do |c|
|
||||||
if c.start_with?('@')
|
if c.start_with?('@')
|
||||||
account_parts = c.split('@')[1..2]
|
account_parts = c.split('@')[1..2]
|
||||||
successful = account_policy(account_parts[0], account_parts[1], action)
|
successful = account_policy(account_parts[0], account_parts[1], action, reason)
|
||||||
else
|
else
|
||||||
successful = domain_policy(c, action)
|
successful = domain_policy(c, action, reason)
|
||||||
end
|
end
|
||||||
if successful
|
if successful
|
||||||
output << "\u2705 <code>#{c}</code>"
|
output << "\u2705 <code>#{c}</code>"
|
||||||
|
@ -757,7 +758,12 @@ class Bangtags
|
||||||
output << "\u274c <code>#{c}</code>"
|
output << "\u274c <code>#{c}</code>"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
output = ['<em>No action.</em>'] if output.blank?
|
if output.blank?
|
||||||
|
output = ['<em>No action.</em>']
|
||||||
|
elsif !reason.blank?
|
||||||
|
output << ''
|
||||||
|
output << "<strong>Comment:</strong> <em>#{reason}</em>"
|
||||||
|
end
|
||||||
chunk = output.join("\n") + "\n"
|
chunk = output.join("\n") + "\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Admin::ActionLog < ApplicationRecord
|
||||||
when :destroy, :create
|
when :destroy, :create
|
||||||
self.recorded_changes = target.attributes
|
self.recorded_changes = target.attributes
|
||||||
when :update, :promote, :demote
|
when :update, :promote, :demote
|
||||||
self.recorded_changes = target.previous_changes
|
self.recorded_changes = target_type != 'DomainBlock' ? target.previous_changes : target.attributes
|
||||||
when :change_email
|
when :change_email
|
||||||
self.recorded_changes = ActiveSupport::HashWithIndifferentAccess.new(
|
self.recorded_changes = ActiveSupport::HashWithIndifferentAccess.new(
|
||||||
email: [target.email, nil],
|
email: [target.email, nil],
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
# reject_media :boolean default(FALSE), not null
|
# reject_media :boolean default(FALSE), not null
|
||||||
# reject_reports :boolean default(FALSE), not null
|
# reject_reports :boolean default(FALSE), not null
|
||||||
# force_sensitive :boolean default(FALSE), not null
|
# force_sensitive :boolean default(FALSE), not null
|
||||||
|
# reason :text
|
||||||
#
|
#
|
||||||
|
|
||||||
class DomainBlock < ApplicationRecord
|
class DomainBlock < ApplicationRecord
|
||||||
|
@ -53,4 +54,9 @@ class DomainBlock < ApplicationRecord
|
||||||
additionals << "reject reports" if reject_reports?
|
additionals << "reject reports" if reject_reports?
|
||||||
additionals
|
additionals
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# workaround for the domain policy editor
|
||||||
|
def undo
|
||||||
|
return false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,4 +16,8 @@ class DomainBlockPolicy < ApplicationPolicy
|
||||||
def destroy?
|
def destroy?
|
||||||
staff?
|
staff?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update?
|
||||||
|
staff?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,11 +5,16 @@ class BlockDomainService < BaseService
|
||||||
|
|
||||||
def call(domain_block)
|
def call(domain_block)
|
||||||
@domain_block = domain_block
|
@domain_block = domain_block
|
||||||
|
remove_existing_block!
|
||||||
process_domain_block!
|
process_domain_block!
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def remove_existing_block!
|
||||||
|
UnblockDomainService.new.call(@domain_block, false)
|
||||||
|
end
|
||||||
|
|
||||||
def process_domain_block!
|
def process_domain_block!
|
||||||
clear_media! if domain_block.reject_media?
|
clear_media! if domain_block.reject_media?
|
||||||
force_accounts_sensitive! if domain_block.force_sensitive?
|
force_accounts_sensitive! if domain_block.force_sensitive?
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
class UnblockDomainService < BaseService
|
class UnblockDomainService < BaseService
|
||||||
attr_accessor :domain_block
|
attr_accessor :domain_block
|
||||||
|
|
||||||
def call(domain_block)
|
def call(domain_block, destroy_domain_block = true)
|
||||||
@domain_block = domain_block
|
@domain_block = domain_block
|
||||||
process_retroactive_updates
|
process_retroactive_updates
|
||||||
domain_block.destroy
|
domain_block.destroy if destroy_domain_block
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_retroactive_updates
|
def process_retroactive_updates
|
||||||
|
|
|
@ -20,5 +20,8 @@
|
||||||
.fields-group
|
.fields-group
|
||||||
= f.input :reject_reports, as: :boolean, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_reports'), hint: I18n.t('admin.domain_blocks.reject_reports_hint')
|
= f.input :reject_reports, as: :boolean, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_reports'), hint: I18n.t('admin.domain_blocks.reject_reports_hint')
|
||||||
|
|
||||||
|
.fields-group
|
||||||
|
= f.input :reason, placeholder: t('admin.domain_blocks.reason', rows: 6)
|
||||||
|
|
||||||
.actions
|
.actions
|
||||||
= f.button :button, t('.create'), type: :submit
|
= f.button :button, t('.create'), type: :submit
|
||||||
|
|
|
@ -1,13 +1,30 @@
|
||||||
- content_for :page_title do
|
- content_for :page_title do
|
||||||
= t('admin.domain_blocks.show.title', domain: @domain_block.domain)
|
= t('admin.domain_blocks.show.title', domain: @domain_block.domain)
|
||||||
|
|
||||||
= simple_form_for @domain_block, url: admin_domain_block_path(@domain_block), method: :delete do |f|
|
= simple_form_for @domain_block, url: admin_domain_block_path(@domain_block) do |f|
|
||||||
|
= render 'shared/error_messages', object: @domain_block
|
||||||
|
|
||||||
- unless (@domain_block.noop?)
|
.fields-row
|
||||||
%p= t(".retroactive.#{@domain_block.severity}")
|
.fields-row__column.fields-row__column-6.fields-group
|
||||||
%p.hint= t(:affected_accounts,
|
= f.input :domain, wrapper: :with_label, label: t('admin.domain_blocks.domain'), required: true, disabled: true
|
||||||
scope: [:admin, :domain_blocks, :show],
|
|
||||||
count: @domain_block.affected_accounts_count)
|
.fields-row__column.fields-row__column-6.fields-group
|
||||||
|
= f.input :severity, collection: DomainBlock.severities.keys, wrapper: :with_label, include_blank: false, label_method: lambda { |type| t(".severity.#{type}") }
|
||||||
|
|
||||||
|
.fields-group
|
||||||
|
= f.input :force_sensitive, as: :boolean, wrapper: :with_label, label: I18n.t('admin.domain_blocks.force_sensitive'), hint: I18n.t('admin.domain_blocks.force_sensitive_hint')
|
||||||
|
|
||||||
|
.fields-group
|
||||||
|
= f.input :reject_media, as: :boolean, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_media'), hint: I18n.t('admin.domain_blocks.reject_media_hint')
|
||||||
|
|
||||||
|
.fields-group
|
||||||
|
= f.input :reject_reports, as: :boolean, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_reports'), hint: I18n.t('admin.domain_blocks.reject_reports_hint')
|
||||||
|
|
||||||
|
.fields-group
|
||||||
|
= f.input :undo, as: :boolean, wrapper: :with_label, label: I18n.t('admin.domain_blocks.undo'), hint: I18n.t('admin.domain_blocks.undo_hint')
|
||||||
|
|
||||||
|
.fields-group
|
||||||
|
= f.input :reason, placeholder: t('admin.domain_blocks.reason', rows: 6)
|
||||||
|
|
||||||
.actions
|
.actions
|
||||||
= f.button :button, t('.undo'), type: :submit
|
= f.button :button, t('.edit'), type: :submit
|
||||||
|
|
|
@ -46,6 +46,9 @@
|
||||||
•
|
•
|
||||||
= t('admin.domain_blocks.rejecting_reports')
|
= t('admin.domain_blocks.rejecting_reports')
|
||||||
|
|
||||||
|
- if instance.domain_block.reason
|
||||||
|
= simple_format(h("Policy reason: #{instance.domain_block.reason}"))
|
||||||
|
|
||||||
.avatar-stack
|
.avatar-stack
|
||||||
- instance.cached_sample_accounts.each do |account|
|
- instance.cached_sample_accounts.each do |account|
|
||||||
= image_tag current_account&.user&.setting_auto_play_gif ? account.avatar_original_url : account.avatar_static_url, width: 48, height: 48, alt: '', class: 'account__avatar'
|
= image_tag current_account&.user&.setting_auto_play_gif ? account.avatar_original_url : account.avatar_static_url, width: 48, height: 48, alt: '', class: 'account__avatar'
|
||||||
|
|
|
@ -31,6 +31,13 @@
|
||||||
= fa_icon 'times'
|
= fa_icon 'times'
|
||||||
.dashboard__counters__label= t 'admin.instances.delivery_available'
|
.dashboard__counters__label= t 'admin.instances.delivery_available'
|
||||||
|
|
||||||
|
- if @domain_block
|
||||||
|
%hr.spacer/
|
||||||
|
|
||||||
|
%h3= "Affected by #{@domain_block.severity.gsub('_', ' ')} policy"
|
||||||
|
- if @domain_block.reason
|
||||||
|
= simple_format(h(@domain_block.reason))
|
||||||
|
|
||||||
%hr.spacer/
|
%hr.spacer/
|
||||||
|
|
||||||
%div{ style: 'overflow: hidden' }
|
%div{ style: 'overflow: hidden' }
|
||||||
|
@ -39,6 +46,6 @@
|
||||||
|
|
||||||
%div{ style: 'float: right' }
|
%div{ style: 'float: right' }
|
||||||
- if @domain_block
|
- if @domain_block
|
||||||
= link_to t('admin.domain_blocks.undo'), admin_domain_block_path(@domain_block), class: 'button'
|
= link_to t('admin.domain_blocks.edit'), admin_domain_block_path(@domain_block), class: 'button'
|
||||||
- else
|
- else
|
||||||
= link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path(_domain: @instance.domain), class: 'button'
|
= link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path(_domain: @instance.domain), class: 'button'
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
class DomainBlockWorker
|
class DomainBlockWorker
|
||||||
include Sidekiq::Worker
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
sidekiq_options unique: :until_executed
|
||||||
|
|
||||||
def perform(domain_block_id)
|
def perform(domain_block_id)
|
||||||
BlockDomainService.new.call(DomainBlock.find(domain_block_id))
|
BlockDomainService.new.call(DomainBlock.find(domain_block_id))
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class DomainUnblockWorker
|
||||||
|
include Sidekiq::Worker
|
||||||
|
|
||||||
|
sidekiq_options unique: :until_executed
|
||||||
|
|
||||||
|
def perform(domain_block_id)
|
||||||
|
UnblockDomainService.new.call(DomainBlock.find(domain_block_id))
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
true
|
||||||
|
end
|
||||||
|
end
|
|
@ -204,7 +204,7 @@ en:
|
||||||
confirm_user: "%{name} confirmed e-mail address of creature %{target}"
|
confirm_user: "%{name} confirmed e-mail address of creature %{target}"
|
||||||
create_account_warning: "%{name} sent a warning to %{target}"
|
create_account_warning: "%{name} sent a warning to %{target}"
|
||||||
create_custom_emoji: "%{name} uploaded new emoji %{target}"
|
create_custom_emoji: "%{name} uploaded new emoji %{target}"
|
||||||
create_domain_block: "%{name} changed policy for %{target}"
|
create_domain_block: "%{name} added or changed policy for %{target}"
|
||||||
create_email_domain_block: "%{name} blacklisted e-mail domain %{target}"
|
create_email_domain_block: "%{name} blacklisted e-mail domain %{target}"
|
||||||
demote_user: "%{name} demoted creature %{target}"
|
demote_user: "%{name} demoted creature %{target}"
|
||||||
destroy_custom_emoji: "%{name} destroyed emoji %{target}"
|
destroy_custom_emoji: "%{name} destroyed emoji %{target}"
|
||||||
|
@ -233,6 +233,7 @@ en:
|
||||||
unsilence_account: "%{name} unsilenced %{target}'s account"
|
unsilence_account: "%{name} unsilenced %{target}'s account"
|
||||||
unsuspend_account: "%{name} unsuspended %{target}'s account"
|
unsuspend_account: "%{name} unsuspended %{target}'s account"
|
||||||
update_custom_emoji: "%{name} updated emoji %{target}"
|
update_custom_emoji: "%{name} updated emoji %{target}"
|
||||||
|
update_domain_block: "%{name} updated policy for %{target}"
|
||||||
update_status: "%{name} updated roar by %{target}"
|
update_status: "%{name} updated roar by %{target}"
|
||||||
deleted_status: "(deleted roar)"
|
deleted_status: "(deleted roar)"
|
||||||
title: Audit log
|
title: Audit log
|
||||||
|
@ -288,6 +289,7 @@ en:
|
||||||
domain_blocks:
|
domain_blocks:
|
||||||
add_new: Add new domain policy
|
add_new: Add new domain policy
|
||||||
created_msg: Domain policy is now being processed
|
created_msg: Domain policy is now being processed
|
||||||
|
updated_msg: Domain policy change is now being processed
|
||||||
destroyed_msg: Domain policy has been undone
|
destroyed_msg: Domain policy has been undone
|
||||||
domain: Domain
|
domain: Domain
|
||||||
existing_domain_block_html: You have already imposed stricter limits on %{name}, you need to <a href="%{unblock_url}">remove it</a> first.
|
existing_domain_block_html: You have already imposed stricter limits on %{name}, you need to <a href="%{unblock_url}">remove it</a> first.
|
||||||
|
@ -303,6 +305,7 @@ en:
|
||||||
title: New domain policy
|
title: New domain policy
|
||||||
force_sensitive: Mark media sensitive
|
force_sensitive: Mark media sensitive
|
||||||
force_sensitive_hint: Forces all media from this domain to be marked sensitive.
|
force_sensitive_hint: Forces all media from this domain to be marked sensitive.
|
||||||
|
reason: Add notes here.
|
||||||
reject_media: Reject media files
|
reject_media: Reject media files
|
||||||
reject_media_hint: Removes locally stored media files and refuses to download any in the future. Irrelevant for suspensions
|
reject_media_hint: Removes locally stored media files and refuses to download any in the future. Irrelevant for suspensions
|
||||||
reject_reports: Reject reports
|
reject_reports: Reject reports
|
||||||
|
@ -321,9 +324,12 @@ en:
|
||||||
silence: Unsilence existing affected accounts from this domain
|
silence: Unsilence existing affected accounts from this domain
|
||||||
suspend: Unsuspend existing affected accounts from this domain
|
suspend: Unsuspend existing affected accounts from this domain
|
||||||
force_unlisted: Allow public roars on all existing accounts from this domain
|
force_unlisted: Allow public roars on all existing accounts from this domain
|
||||||
title: Undo domain policy for %{domain}
|
title: Edit domain policy for %{domain}
|
||||||
undo: Undo
|
undo: Undo
|
||||||
|
edit: Edit
|
||||||
undo: Undo domain policy
|
undo: Undo domain policy
|
||||||
|
edit: Edit domain policy
|
||||||
|
undo_hint: Removes the domain policy, allowing for normal federation
|
||||||
email_domain_blocks:
|
email_domain_blocks:
|
||||||
add_new: Add new
|
add_new: Add new
|
||||||
created_msg: Successfully added e-mail domain to blacklist
|
created_msg: Successfully added e-mail domain to blacklist
|
||||||
|
|
|
@ -150,7 +150,7 @@ Rails.application.routes.draw do
|
||||||
get '/dashboard', to: 'dashboard#index'
|
get '/dashboard', to: 'dashboard#index'
|
||||||
|
|
||||||
resources :subscriptions, only: [:index]
|
resources :subscriptions, only: [:index]
|
||||||
resources :domain_blocks, only: [:new, :create, :show, :destroy]
|
resources :domain_blocks, only: [:new, :create, :show, :destroy, :update]
|
||||||
resources :email_domain_blocks, only: [:index, :new, :create, :destroy]
|
resources :email_domain_blocks, only: [:index, :new, :create, :destroy]
|
||||||
resources :action_logs, only: [:index]
|
resources :action_logs, only: [:index]
|
||||||
resources :warning_presets, except: [:new]
|
resources :warning_presets, except: [:new]
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddReasonToDomainBlocks < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :domain_blocks, :reason, :text
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2019_07_28_201832) do
|
ActiveRecord::Schema.define(version: 2019_07_30_213656) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -269,6 +269,7 @@ ActiveRecord::Schema.define(version: 2019_07_28_201832) do
|
||||||
t.boolean "reject_media", default: false, null: false
|
t.boolean "reject_media", default: false, null: false
|
||||||
t.boolean "reject_reports", default: false, null: false
|
t.boolean "reject_reports", default: false, null: false
|
||||||
t.boolean "force_sensitive", default: false, null: false
|
t.boolean "force_sensitive", default: false, null: false
|
||||||
|
t.text "reason"
|
||||||
t.index ["domain"], name: "index_domain_blocks_on_domain", unique: true
|
t.index ["domain"], name: "index_domain_blocks_on_domain", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue