parent
dc3aabb4f4
commit
76b24193c4
18 changed files with 31 additions and 82 deletions
|
@ -88,17 +88,17 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_params
|
def update_params
|
||||||
params.require(:domain_block).permit(:severity, :reject_media, :reject_favourite, :reject_reply, :reject_reply_exclude_followers, :reject_send_sensitive, :reject_hashtag,
|
params.require(:domain_block).permit(:severity, :reject_media, :reject_favourite, :reject_reply_exclude_followers, :reject_send_sensitive, :reject_hashtag,
|
||||||
:reject_straight_follow, :reject_new_follow, :reject_friend, :block_trends, :detect_invalid_subscription, :reject_reports, :private_comment, :public_comment, :obfuscate, :hidden)
|
:reject_straight_follow, :reject_new_follow, :reject_friend, :block_trends, :detect_invalid_subscription, :reject_reports, :private_comment, :public_comment, :obfuscate, :hidden)
|
||||||
end
|
end
|
||||||
|
|
||||||
def resource_params
|
def resource_params
|
||||||
params.require(:domain_block).permit(:domain, :severity, :reject_media, :reject_favourite, :reject_reply, :reject_reply_exclude_followers, :reject_send_sensitive, :reject_hashtag,
|
params.require(:domain_block).permit(:domain, :severity, :reject_media, :reject_favourite, :reject_reply_exclude_followers, :reject_send_sensitive, :reject_hashtag,
|
||||||
:reject_straight_follow, :reject_new_follow, :reject_friend, :block_trends, :detect_invalid_subscription, :reject_reports, :private_comment, :public_comment, :obfuscate, :hidden)
|
:reject_straight_follow, :reject_new_follow, :reject_friend, :block_trends, :detect_invalid_subscription, :reject_reports, :private_comment, :public_comment, :obfuscate, :hidden)
|
||||||
end
|
end
|
||||||
|
|
||||||
def form_domain_block_batch_params
|
def form_domain_block_batch_params
|
||||||
params.require(:form_domain_block_batch).permit(domain_blocks_attributes: [:enabled, :domain, :severity, :reject_media, :reject_favourite, :reject_reply, :reject_reply_exclude_followers,
|
params.require(:form_domain_block_batch).permit(domain_blocks_attributes: [:enabled, :domain, :severity, :reject_media, :reject_favourite, :reject_reply_exclude_followers,
|
||||||
:reject_send_sensitive, :reject_hashtag, :reject_straight_follow, :reject_new_follow, :reject_friend, :block_trends, :detect_invalid_subscription,
|
:reject_send_sensitive, :reject_hashtag, :reject_straight_follow, :reject_new_follow, :reject_friend, :block_trends, :detect_invalid_subscription,
|
||||||
:reject_reports, :private_comment, :public_comment, :obfuscate, :hidden])
|
:reject_reports, :private_comment, :public_comment, :obfuscate, :hidden])
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,7 +38,6 @@ module Admin
|
||||||
public_comment: row['#public_comment'],
|
public_comment: row['#public_comment'],
|
||||||
obfuscate: row.fetch('#obfuscate', false),
|
obfuscate: row.fetch('#obfuscate', false),
|
||||||
reject_favourite: row.fetch('#reject_favourite', false),
|
reject_favourite: row.fetch('#reject_favourite', false),
|
||||||
reject_reply: row.fetch('#reject_reply', false),
|
|
||||||
reject_send_sensitive: row.fetch('#reject_send_sensitive', false),
|
reject_send_sensitive: row.fetch('#reject_send_sensitive', false),
|
||||||
reject_hashtag: row.fetch('#reject_hashtag', false),
|
reject_hashtag: row.fetch('#reject_hashtag', false),
|
||||||
reject_straight_follow: row.fetch('#reject_straight_follow', false),
|
reject_straight_follow: row.fetch('#reject_straight_follow', false),
|
||||||
|
@ -86,7 +85,6 @@ module Admin
|
||||||
#public_comment
|
#public_comment
|
||||||
#obfuscate
|
#obfuscate
|
||||||
#reject_favourite
|
#reject_favourite
|
||||||
#reject_reply
|
|
||||||
#reject_send_sensitive
|
#reject_send_sensitive
|
||||||
#reject_hashtag
|
#reject_hashtag
|
||||||
#reject_straight_follow
|
#reject_straight_follow
|
||||||
|
@ -110,7 +108,6 @@ module Admin
|
||||||
instance.public_comment,
|
instance.public_comment,
|
||||||
instance.obfuscate,
|
instance.obfuscate,
|
||||||
instance.reject_favourite,
|
instance.reject_favourite,
|
||||||
instance.reject_reply,
|
|
||||||
instance.reject_send_sensitive,
|
instance.reject_send_sensitive,
|
||||||
instance.reject_hashtag,
|
instance.reject_hashtag,
|
||||||
instance.reject_straight_follow,
|
instance.reject_straight_follow,
|
||||||
|
|
|
@ -69,7 +69,7 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def domain_block_params
|
def domain_block_params
|
||||||
params.permit(:severity, :reject_media, :reject_favourite, :reject_reply, :reject_reply_exclude_followers, :reject_reports, :reject_send_sensitive, :reject_hashtag, :reject_straight_follow,
|
params.permit(:severity, :reject_media, :reject_favourite, :reject_reply_exclude_followers, :reject_reports, :reject_send_sensitive, :reject_hashtag, :reject_straight_follow,
|
||||||
:reject_new_follow, :reject_friend, :block_trends, :detect_invalid_subscription, :private_comment, :public_comment, :obfuscate, :hidden)
|
:reject_new_follow, :reject_friend, :block_trends, :detect_invalid_subscription, :private_comment, :public_comment, :obfuscate, :hidden)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def resource_params
|
def resource_params
|
||||||
params.permit(:domain, :severity, :reject_media, :reject_favourite, :reject_reply, :reject_reply_exclude_followers, :reject_send_sensitive, :reject_hashtag, :reject_straight_follow,
|
params.permit(:domain, :severity, :reject_media, :reject_favourite, :reject_reply_exclude_followers, :reject_send_sensitive, :reject_hashtag, :reject_straight_follow,
|
||||||
:reject_new_follow, :reject_friend, :block_trends, :detect_invalid_subscription, :reject_reports, :private_comment, :public_comment, :obfuscate, :hidden)
|
:reject_new_follow, :reject_friend, :block_trends, :detect_invalid_subscription, :reject_reports, :private_comment, :public_comment, :obfuscate, :hidden)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -91,7 +91,6 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||||
process_audience
|
process_audience
|
||||||
|
|
||||||
return nil unless valid_status?
|
return nil unless valid_status?
|
||||||
return nil if (mention_to_local? || reference_to_local_account?) && reject_reply_to_local?
|
|
||||||
return nil if (mention_to_local_stranger? || reference_to_local_stranger?) && reject_reply_exclude_followers?
|
return nil if (mention_to_local_stranger? || reference_to_local_stranger?) && reject_reply_exclude_followers?
|
||||||
|
|
||||||
ApplicationRecord.transaction do
|
ApplicationRecord.transaction do
|
||||||
|
@ -510,10 +509,6 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||||
!replied_to_status.nil? && replied_to_status.account.local?
|
!replied_to_status.nil? && replied_to_status.account.local?
|
||||||
end
|
end
|
||||||
|
|
||||||
def mention_to_local?
|
|
||||||
mentioned_accounts.any?(&:local?)
|
|
||||||
end
|
|
||||||
|
|
||||||
def mention_to_local_stranger?
|
def mention_to_local_stranger?
|
||||||
mentioned_accounts.any? { |account| account.local? && !account.following?(@account) }
|
mentioned_accounts.any? { |account| account.local? && !account.following?(@account) }
|
||||||
end
|
end
|
||||||
|
@ -532,10 +527,6 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||||
local_referred_accounts.any? { |account| !account.following?(@account) }
|
local_referred_accounts.any? { |account| !account.following?(@account) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def reject_reply_to_local?
|
|
||||||
@reject_reply_to_local ||= DomainBlock.reject_reply?(@account.domain)
|
|
||||||
end
|
|
||||||
|
|
||||||
def reject_reply_exclude_followers?
|
def reject_reply_exclude_followers?
|
||||||
@reject_reply_exclude_followers ||= DomainBlock.reject_reply_exclude_followers?(@account.domain)
|
@reject_reply_exclude_followers ||= DomainBlock.reject_reply_exclude_followers?(@account.domain)
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Admin::Import
|
||||||
field&.strip
|
field&.strip
|
||||||
when '#severity'
|
when '#severity'
|
||||||
field&.strip&.to_sym
|
field&.strip&.to_sym
|
||||||
when '#reject_media', '#reject_reports', '#obfuscate', '#reject_favourite', '#reject_reply', '#reject_send_sensitive',
|
when '#reject_media', '#reject_reports', '#obfuscate', '#reject_favourite', '#reject_send_sensitive',
|
||||||
'#reject_hashtag', '#reject_straight_follow', '#reject_new_follow', '#hidden', '#detect_invalid_subscription',
|
'#reject_hashtag', '#reject_straight_follow', '#reject_new_follow', '#hidden', '#detect_invalid_subscription',
|
||||||
'#reject_reply_exclude_followers', '#reject_friend', '#block_trends'
|
'#reject_reply_exclude_followers', '#reject_friend', '#block_trends'
|
||||||
ActiveModel::Type::Boolean.new.cast(field)
|
ActiveModel::Type::Boolean.new.cast(field)
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
# public_comment :text
|
# public_comment :text
|
||||||
# obfuscate :boolean default(FALSE), not null
|
# obfuscate :boolean default(FALSE), not null
|
||||||
# reject_favourite :boolean default(FALSE), not null
|
# reject_favourite :boolean default(FALSE), not null
|
||||||
# reject_reply :boolean default(FALSE), not null
|
|
||||||
# reject_send_sensitive :boolean default(FALSE), not null
|
# reject_send_sensitive :boolean default(FALSE), not null
|
||||||
# reject_hashtag :boolean default(FALSE), not null
|
# reject_hashtag :boolean default(FALSE), not null
|
||||||
# reject_straight_follow :boolean default(FALSE), not null
|
# reject_straight_follow :boolean default(FALSE), not null
|
||||||
|
@ -44,7 +43,6 @@ class DomainBlock < ApplicationRecord
|
||||||
where(severity: [:silence, :suspend])
|
where(severity: [:silence, :suspend])
|
||||||
.or(where(reject_media: true))
|
.or(where(reject_media: true))
|
||||||
.or(where(reject_favourite: true))
|
.or(where(reject_favourite: true))
|
||||||
.or(where(reject_reply: true))
|
|
||||||
.or(where(reject_reply_exclude_followers: true))
|
.or(where(reject_reply_exclude_followers: true))
|
||||||
.or(where(reject_new_follow: true))
|
.or(where(reject_new_follow: true))
|
||||||
.or(where(reject_straight_follow: true))
|
.or(where(reject_straight_follow: true))
|
||||||
|
@ -64,7 +62,6 @@ class DomainBlock < ApplicationRecord
|
||||||
[severity.to_sym,
|
[severity.to_sym,
|
||||||
reject_media? ? :reject_media : nil,
|
reject_media? ? :reject_media : nil,
|
||||||
reject_favourite? ? :reject_favourite : nil,
|
reject_favourite? ? :reject_favourite : nil,
|
||||||
reject_reply? ? :reject_reply : nil,
|
|
||||||
reject_reply_exclude_followers? ? :reject_reply_exclude_followers : nil,
|
reject_reply_exclude_followers? ? :reject_reply_exclude_followers : nil,
|
||||||
reject_send_sensitive? ? :reject_send_sensitive : nil,
|
reject_send_sensitive? ? :reject_send_sensitive : nil,
|
||||||
reject_hashtag? ? :reject_hashtag : nil,
|
reject_hashtag? ? :reject_hashtag : nil,
|
||||||
|
@ -94,10 +91,6 @@ class DomainBlock < ApplicationRecord
|
||||||
!!rule_for(domain)&.reject_favourite?
|
!!rule_for(domain)&.reject_favourite?
|
||||||
end
|
end
|
||||||
|
|
||||||
def reject_reply?(domain)
|
|
||||||
!!rule_for(domain)&.reject_reply?
|
|
||||||
end
|
|
||||||
|
|
||||||
def reject_reply_exclude_followers?(domain)
|
def reject_reply_exclude_followers?(domain)
|
||||||
!!rule_for(domain)&.reject_reply_exclude_followers?
|
!!rule_for(domain)&.reject_reply_exclude_followers?
|
||||||
end
|
end
|
||||||
|
@ -150,7 +143,7 @@ class DomainBlock < ApplicationRecord
|
||||||
return false if other_block.suspend? && (silence? || noop?)
|
return false if other_block.suspend? && (silence? || noop?)
|
||||||
return false if other_block.silence? && noop?
|
return false if other_block.silence? && noop?
|
||||||
|
|
||||||
(reject_media || !other_block.reject_media) && (reject_favourite || !other_block.reject_favourite) && (reject_reply || !other_block.reject_reply) && (reject_reply_exclude_followers || !other_block.reject_reply_exclude_followers) && (reject_reports || !other_block.reject_reports)
|
(reject_media || !other_block.reject_media) && (reject_favourite || !other_block.reject_favourite) && (reject_reply_exclude_followers || !other_block.reject_reply_exclude_followers) && (reject_reports || !other_block.reject_reports)
|
||||||
end
|
end
|
||||||
|
|
||||||
def public_domain
|
def public_domain
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class REST::Admin::DomainBlockSerializer < ActiveModel::Serializer
|
class REST::Admin::DomainBlockSerializer < ActiveModel::Serializer
|
||||||
attributes :id, :domain, :digest, :created_at, :severity,
|
attributes :id, :domain, :digest, :created_at, :severity,
|
||||||
:reject_media, :reject_favourite, :reject_reply, :reject_reports,
|
:reject_media, :reject_favourite, :reject_reports,
|
||||||
:reject_reply_exclude_followers, :reject_send_sensitive, :block_trends,
|
:reject_reply_exclude_followers, :reject_send_sensitive, :block_trends,
|
||||||
:reject_hashtag, :reject_straight_follow, :reject_new_follow, :reject_friend, :detect_invalid_subscription,
|
:reject_hashtag, :reject_straight_follow, :reject_new_follow, :reject_friend, :detect_invalid_subscription,
|
||||||
:private_comment, :public_comment, :obfuscate
|
:private_comment, :public_comment, :obfuscate
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
.fields-group
|
.fields-group
|
||||||
= f.input :reject_favourite, as: :boolean, kmyblue: true, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_favourite'), hint: I18n.t('admin.domain_blocks.reject_favourite_hint')
|
= f.input :reject_favourite, as: :boolean, kmyblue: true, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_favourite'), hint: I18n.t('admin.domain_blocks.reject_favourite_hint')
|
||||||
|
|
||||||
.fields-group
|
|
||||||
= f.input :reject_reply, as: :boolean, kmyblue: true, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_reply'), hint: I18n.t('admin.domain_blocks.reject_reply_hint')
|
|
||||||
|
|
||||||
.fields-group
|
.fields-group
|
||||||
= f.input :reject_reply_exclude_followers, as: :boolean, kmyblue: true, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_reply_exclude_followers'), hint: I18n.t('admin.domain_blocks.reject_reply_exclude_followers_hint')
|
= f.input :reject_reply_exclude_followers, as: :boolean, kmyblue: true, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_reply_exclude_followers'), hint: I18n.t('admin.domain_blocks.reject_reply_exclude_followers_hint')
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
= f.hidden_field :severity
|
= f.hidden_field :severity
|
||||||
= f.hidden_field :reject_media
|
= f.hidden_field :reject_media
|
||||||
= f.hidden_field :reject_favourite
|
= f.hidden_field :reject_favourite
|
||||||
= f.hidden_field :reject_reply
|
|
||||||
= f.hidden_field :reject_reply_exclude_followers
|
= f.hidden_field :reject_reply_exclude_followers
|
||||||
= f.hidden_field :reject_send_sensitive
|
= f.hidden_field :reject_send_sensitive
|
||||||
= f.hidden_field :reject_hashtag
|
= f.hidden_field :reject_hashtag
|
||||||
|
|
|
@ -457,7 +457,6 @@ en:
|
||||||
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_new_follow: Reject follows
|
reject_new_follow: Reject follows
|
||||||
reject_new_follow_hint: Reject follows in the future
|
reject_new_follow_hint: Reject follows in the future
|
||||||
reject_reply: Reject replies
|
|
||||||
reject_reply_exclude_followers: Reject mentions/references exclude followers
|
reject_reply_exclude_followers: Reject mentions/references exclude followers
|
||||||
reject_reply_hint: Reject replies in the future
|
reject_reply_hint: Reject replies in the future
|
||||||
reject_reply_exclude_followers_hint: Reject replies exclude followers in the future
|
reject_reply_exclude_followers_hint: Reject replies exclude followers in the future
|
||||||
|
@ -574,7 +573,6 @@ en:
|
||||||
reject_media: Reject media
|
reject_media: Reject media
|
||||||
reject_new_follow: Reject follows
|
reject_new_follow: Reject follows
|
||||||
reject_straight_follow: Reject straight follow
|
reject_straight_follow: Reject straight follow
|
||||||
reject_reply: Reject reply
|
|
||||||
reject_reply_exclude_followers: Reject reply/reference exclude followers
|
reject_reply_exclude_followers: Reject reply/reference exclude followers
|
||||||
reject_reports: Reject reports
|
reject_reports: Reject reports
|
||||||
silence: Limit
|
silence: Limit
|
||||||
|
|
|
@ -452,7 +452,6 @@ ja:
|
||||||
reject_media_hint: ローカルに保存されたメディアファイルを削除し、今後のダウンロードを拒否します。停止とは無関係です
|
reject_media_hint: ローカルに保存されたメディアファイルを削除し、今後のダウンロードを拒否します。停止とは無関係です
|
||||||
reject_new_follow: 新規フォローを拒否
|
reject_new_follow: 新規フォローを拒否
|
||||||
reject_new_follow_hint: 今後の新規フォローを拒否します。停止とは無関係です
|
reject_new_follow_hint: 今後の新規フォローを拒否します。停止とは無関係です
|
||||||
reject_reply: リプライを拒否
|
|
||||||
reject_reply_exclude_followers: フォロー相手以外からのメンションと参照を拒否
|
reject_reply_exclude_followers: フォロー相手以外からのメンションと参照を拒否
|
||||||
reject_reply_hint: 今後のリプライを拒否します。停止とは無関係です
|
reject_reply_hint: 今後のリプライを拒否します。停止とは無関係です
|
||||||
reject_reply_exclude_followers_hint: 今後のリプライを拒否します。停止とは無関係です
|
reject_reply_exclude_followers_hint: 今後のリプライを拒否します。停止とは無関係です
|
||||||
|
@ -566,7 +565,6 @@ ja:
|
||||||
reject_hashtag: ハッシュタグを拒否
|
reject_hashtag: ハッシュタグを拒否
|
||||||
reject_media: メディアを拒否する
|
reject_media: メディアを拒否する
|
||||||
reject_new_follow: 新規フォローを拒否
|
reject_new_follow: 新規フォローを拒否
|
||||||
reject_reply: リプライを拒否
|
|
||||||
reject_reply_exclude_followers: フォロー相手以外からのメンション・参照を拒否
|
reject_reply_exclude_followers: フォロー相手以外からのメンション・参照を拒否
|
||||||
reject_reports: 通報を拒否
|
reject_reports: 通報を拒否
|
||||||
reject_send_sensitive: センシティブ投稿配送なし
|
reject_send_sensitive: センシティブ投稿配送なし
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class RemoveRejectReplyFromDomainBlocks < ActiveRecord::Migration[7.1]
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
|
def change
|
||||||
|
safety_assured { remove_column :domain_blocks, :reject_reply, :boolean, null: false, default: false }
|
||||||
|
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[7.1].define(version: 2024_02_27_225017) do
|
ActiveRecord::Schema[7.1].define(version: 2024_02_29_233617) 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"
|
||||||
|
|
||||||
|
@ -565,7 +565,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_02_27_225017) do
|
||||||
t.text "public_comment"
|
t.text "public_comment"
|
||||||
t.boolean "obfuscate", default: false, null: false
|
t.boolean "obfuscate", default: false, null: false
|
||||||
t.boolean "reject_favourite", default: false, null: false
|
t.boolean "reject_favourite", default: false, null: false
|
||||||
t.boolean "reject_reply", default: false, null: false
|
|
||||||
t.boolean "reject_send_sensitive", default: false, null: false
|
t.boolean "reject_send_sensitive", default: false, null: false
|
||||||
t.boolean "reject_hashtag", default: false, null: false
|
t.boolean "reject_hashtag", default: false, null: false
|
||||||
t.boolean "reject_straight_follow", default: false, null: false
|
t.boolean "reject_straight_follow", default: false, null: false
|
||||||
|
|
|
@ -92,6 +92,7 @@ namespace :dangerous do
|
||||||
20240227033337
|
20240227033337
|
||||||
20240227222450
|
20240227222450
|
||||||
20240227225017
|
20240227225017
|
||||||
|
20240229233617
|
||||||
)
|
)
|
||||||
# Removed: account_groups
|
# Removed: account_groups
|
||||||
target_tables = %w(
|
target_tables = %w(
|
||||||
|
@ -147,7 +148,7 @@ namespace :dangerous do
|
||||||
%w(domain_blocks reject_friend),
|
%w(domain_blocks reject_friend),
|
||||||
%w(domain_blocks reject_hashtag),
|
%w(domain_blocks reject_hashtag),
|
||||||
%w(domain_blocks reject_new_follow),
|
%w(domain_blocks reject_new_follow),
|
||||||
%w(domain_blocks reject_reply),
|
# Removed: domain_blocks reject_reply
|
||||||
%w(domain_blocks reject_reply_exclude_followers),
|
%w(domain_blocks reject_reply_exclude_followers),
|
||||||
# Removed: domain_blocks reject_send_dissubscribable
|
# Removed: domain_blocks reject_send_dissubscribable
|
||||||
# Removed: domain_blocks reject_send_media
|
# Removed: domain_blocks reject_send_media
|
||||||
|
|
|
@ -22,7 +22,7 @@ RSpec.describe Admin::ExportDomainBlocksController do
|
||||||
Fabricate(:domain_block, domain: 'bad.domain', severity: 'silence', public_comment: 'bad server')
|
Fabricate(:domain_block, domain: 'bad.domain', severity: 'silence', public_comment: 'bad server')
|
||||||
Fabricate(:domain_block, domain: 'worse.domain', severity: 'suspend', reject_media: true, reject_reports: true, public_comment: 'worse server', obfuscate: true)
|
Fabricate(:domain_block, domain: 'worse.domain', severity: 'suspend', reject_media: true, reject_reports: true, public_comment: 'worse server', obfuscate: true)
|
||||||
Fabricate(:domain_block, domain: 'reject.media', severity: 'noop', reject_media: true, public_comment: 'reject media and test unicode characters ♥')
|
Fabricate(:domain_block, domain: 'reject.media', severity: 'noop', reject_media: true, public_comment: 'reject media and test unicode characters ♥')
|
||||||
Fabricate(:domain_block, domain: 'little.spam', severity: 'noop', public_comment: 'has some spams', reject_favourite: true, reject_reply: true, reject_straight_follow: true)
|
Fabricate(:domain_block, domain: 'little.spam', severity: 'noop', public_comment: 'has some spams', reject_favourite: true, reject_straight_follow: true)
|
||||||
Fabricate(:domain_block, domain: 'no.op', severity: 'noop', public_comment: 'noop')
|
Fabricate(:domain_block, domain: 'no.op', severity: 'noop', public_comment: 'noop')
|
||||||
|
|
||||||
get :export, params: { format: :csv }
|
get :export, params: { format: :csv }
|
||||||
|
@ -48,11 +48,11 @@ RSpec.describe Admin::ExportDomainBlocksController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'renders page with extended domain blocks' do
|
it 'renders page with extended domain blocks' do
|
||||||
expect(assigns(:domain_blocks).map { |block| [block.domain, block.reject_favourite, block.reject_reply, block.reject_friend] }).to contain_exactly(
|
expect(assigns(:domain_blocks).map { |block| [block.domain, block.reject_favourite, block.reject_friend] }).to contain_exactly(
|
||||||
['bad.domain', false, false, false],
|
['bad.domain', false, false],
|
||||||
['worse.domain', false, false, false],
|
['worse.domain', false, false],
|
||||||
['reject.media', false, false, false],
|
['reject.media', false, false],
|
||||||
['little.spam', true, true, false]
|
['little.spam', true, false]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
10
spec/fixtures/files/domain_blocks.csv
vendored
10
spec/fixtures/files/domain_blocks.csv
vendored
|
@ -1,5 +1,5 @@
|
||||||
#domain,#severity,#reject_media,#reject_reports,#public_comment,#obfuscate,#reject_favourite,#reject_reply,#reject_send_sensitive,#reject_hashtag,#reject_straight_follow,#reject_new_follow,#hidden,#detect_invalid_subscription,#reject_reply_exclude_followers,#reject_friend,#block_trends
|
#domain,#severity,#reject_media,#reject_reports,#public_comment,#obfuscate,#reject_favourite,#reject_send_sensitive,#reject_hashtag,#reject_straight_follow,#reject_new_follow,#hidden,#detect_invalid_subscription,#reject_reply_exclude_followers,#reject_friend,#block_trends
|
||||||
bad.domain,silence,false,false,bad server,false,false,false,false,false,false,false,false,false,false,false,false
|
bad.domain,silence,false,false,bad server,false,false,false,false,false,false,false,false,false,false,false
|
||||||
worse.domain,suspend,true,true,worse server,true,false,false,false,false,false,false,false,false,false,false,false
|
worse.domain,suspend,true,true,worse server,true,false,false,false,false,false,false,false,false,false,false
|
||||||
reject.media,noop,true,false,reject media and test unicode characters ♥,false,false,false,false,false,false,false,false,false,false,false,false
|
reject.media,noop,true,false,reject media and test unicode characters ♥,false,false,false,false,false,false,false,false,false,false,false
|
||||||
little.spam,noop,false,false,has some spams,false,true,true,false,false,true,false,false,false,false,false,false
|
little.spam,noop,false,false,has some spams,false,true,false,false,true,false,false,false,false,false,false
|
||||||
|
|
|
|
@ -869,36 +869,6 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with mentions domain block reject_reply' do
|
|
||||||
before do
|
|
||||||
Fabricate(:domain_block, domain: 'example.com', severity: :noop, reject_reply: true)
|
|
||||||
subject.perform
|
|
||||||
end
|
|
||||||
|
|
||||||
let(:custom_before) { true }
|
|
||||||
let(:recipient) { Fabricate(:account) }
|
|
||||||
|
|
||||||
let(:object_json) do
|
|
||||||
{
|
|
||||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
|
||||||
type: 'Note',
|
|
||||||
content: 'Lorem ipsum',
|
|
||||||
tag: [
|
|
||||||
{
|
|
||||||
type: 'Mention',
|
|
||||||
href: ActivityPub::TagManager.instance.uri_for(recipient),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'creates status' do
|
|
||||||
status = sender.statuses.first
|
|
||||||
|
|
||||||
expect(status).to be_nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with mentions domain block reject_reply_exclude_followers' do
|
context 'with mentions domain block reject_reply_exclude_followers' do
|
||||||
before do
|
before do
|
||||||
Fabricate(:domain_block, domain: 'example.com', severity: :noop, reject_reply_exclude_followers: true)
|
Fabricate(:domain_block, domain: 'example.com', severity: :noop, reject_reply_exclude_followers: true)
|
||||||
|
|
|
@ -62,7 +62,6 @@ RSpec.describe 'Domain Blocks' do
|
||||||
reject_hashtag: domain_block.reject_hashtag,
|
reject_hashtag: domain_block.reject_hashtag,
|
||||||
detect_invalid_subscription: domain_block.detect_invalid_subscription,
|
detect_invalid_subscription: domain_block.detect_invalid_subscription,
|
||||||
reject_new_follow: domain_block.reject_new_follow,
|
reject_new_follow: domain_block.reject_new_follow,
|
||||||
reject_reply: domain_block.reject_reply,
|
|
||||||
reject_reply_exclude_followers: domain_block.reject_reply_exclude_followers,
|
reject_reply_exclude_followers: domain_block.reject_reply_exclude_followers,
|
||||||
reject_send_sensitive: domain_block.reject_send_sensitive,
|
reject_send_sensitive: domain_block.reject_send_sensitive,
|
||||||
reject_straight_follow: domain_block.reject_straight_follow,
|
reject_straight_follow: domain_block.reject_straight_follow,
|
||||||
|
@ -112,7 +111,6 @@ RSpec.describe 'Domain Blocks' do
|
||||||
reject_hashtag: domain_block.reject_hashtag,
|
reject_hashtag: domain_block.reject_hashtag,
|
||||||
detect_invalid_subscription: domain_block.detect_invalid_subscription,
|
detect_invalid_subscription: domain_block.detect_invalid_subscription,
|
||||||
reject_new_follow: domain_block.reject_new_follow,
|
reject_new_follow: domain_block.reject_new_follow,
|
||||||
reject_reply: domain_block.reject_reply,
|
|
||||||
reject_reply_exclude_followers: domain_block.reject_reply_exclude_followers,
|
reject_reply_exclude_followers: domain_block.reject_reply_exclude_followers,
|
||||||
reject_send_sensitive: domain_block.reject_send_sensitive,
|
reject_send_sensitive: domain_block.reject_send_sensitive,
|
||||||
reject_straight_follow: domain_block.reject_straight_follow,
|
reject_straight_follow: domain_block.reject_straight_follow,
|
||||||
|
@ -145,7 +143,6 @@ RSpec.describe 'Domain Blocks' do
|
||||||
reject_hashtag: domain_block.reject_hashtag,
|
reject_hashtag: domain_block.reject_hashtag,
|
||||||
detect_invalid_subscription: domain_block.detect_invalid_subscription,
|
detect_invalid_subscription: domain_block.detect_invalid_subscription,
|
||||||
reject_new_follow: domain_block.reject_new_follow,
|
reject_new_follow: domain_block.reject_new_follow,
|
||||||
reject_reply: domain_block.reject_reply,
|
|
||||||
reject_reply_exclude_followers: domain_block.reject_reply_exclude_followers,
|
reject_reply_exclude_followers: domain_block.reject_reply_exclude_followers,
|
||||||
reject_send_sensitive: domain_block.reject_send_sensitive,
|
reject_send_sensitive: domain_block.reject_send_sensitive,
|
||||||
reject_straight_follow: domain_block.reject_straight_follow,
|
reject_straight_follow: domain_block.reject_straight_follow,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue