* Add: #437 ドメインブロックで「未ログインユーザーに非公開」の設定を「非公開」にコピーするマイグレーションコード * Fix test for LTS * Fix test
This commit is contained in:
parent
4719ca6525
commit
7694c62bc6
5 changed files with 22 additions and 26 deletions
|
@ -70,7 +70,7 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
|
||||||
|
|
||||||
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_not_public_searchability, :reject_send_public_unlisted, :reject_send_dissubscribable, :reject_send_media, :reject_send_sensitive, :reject_hashtag, :reject_straight_follow,
|
params.permit(:severity, :reject_media, :reject_favourite, :reject_reply, :reject_reply_exclude_followers, :reject_reports, :reject_send_not_public_searchability, :reject_send_public_unlisted, :reject_send_dissubscribable, :reject_send_media, :reject_send_sensitive, :reject_hashtag, :reject_straight_follow,
|
||||||
:reject_new_follow, :reject_friend, :detect_invalid_subscription, :private_comment, :public_comment, :obfuscate, :hidden, :hidden_anonymous)
|
:reject_new_follow, :reject_friend, :detect_invalid_subscription, :private_comment, :public_comment, :obfuscate, :hidden)
|
||||||
end
|
end
|
||||||
|
|
||||||
def insert_pagination_headers
|
def insert_pagination_headers
|
||||||
|
@ -103,6 +103,6 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
|
||||||
|
|
||||||
def resource_params
|
def resource_params
|
||||||
params.permit(:domain, :severity, :reject_media, :reject_favourite, :reject_reply, :reject_reply_exclude_followers, :reject_send_not_public_searchability, :reject_send_public_unlisted, :reject_send_dissubscribable, :reject_send_media, :reject_send_sensitive, :reject_hashtag, :reject_straight_follow,
|
params.permit(:domain, :severity, :reject_media, :reject_favourite, :reject_reply, :reject_reply_exclude_followers, :reject_send_not_public_searchability, :reject_send_public_unlisted, :reject_send_dissubscribable, :reject_send_media, :reject_send_sensitive, :reject_hashtag, :reject_straight_follow,
|
||||||
:reject_new_follow, :reject_friend, :detect_invalid_subscription, :reject_reports, :private_comment, :public_comment, :obfuscate, :hidden, :hidden_anonymous)
|
:reject_new_follow, :reject_friend, :detect_invalid_subscription, :reject_reports, :private_comment, :public_comment, :obfuscate, :hidden)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
# reject_straight_follow :boolean default(FALSE), not null
|
# reject_straight_follow :boolean default(FALSE), not null
|
||||||
# reject_new_follow :boolean default(FALSE), not null
|
# reject_new_follow :boolean default(FALSE), not null
|
||||||
# hidden :boolean default(FALSE), not null
|
# hidden :boolean default(FALSE), not null
|
||||||
# hidden_anonymous :boolean default(FALSE), not null
|
|
||||||
# detect_invalid_subscription :boolean default(FALSE), not null
|
# detect_invalid_subscription :boolean default(FALSE), not null
|
||||||
# reject_reply_exclude_followers :boolean default(FALSE), not null
|
# reject_reply_exclude_followers :boolean default(FALSE), not null
|
||||||
# reject_friend :boolean default(FALSE), not null
|
# reject_friend :boolean default(FALSE), not null
|
||||||
|
@ -44,7 +43,7 @@ class DomainBlock < ApplicationRecord
|
||||||
delegate :count, to: :accounts, prefix: true
|
delegate :count, to: :accounts, prefix: true
|
||||||
|
|
||||||
scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
|
scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
|
||||||
scope :with_user_facing_limitations, -> { where(hidden: false, hidden_anonymous: false) }
|
scope :with_user_facing_limitations, -> { where(hidden: false) }
|
||||||
scope :with_limitations, lambda {
|
scope :with_limitations, lambda {
|
||||||
where(severity: [:silence, :suspend])
|
where(severity: [:silence, :suspend])
|
||||||
.or(where(reject_media: true))
|
.or(where(reject_media: true))
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class RemoveHiddenAnonymousFromDomainBlocks < ActiveRecord::Migration[7.0]
|
||||||
|
class DomainBlock < ApplicationRecord; end
|
||||||
|
|
||||||
|
def up
|
||||||
|
safety_assured do
|
||||||
|
DomainBlock.where(hidden_anonymous: true, hidden: false).update_all(hidden: true)
|
||||||
|
remove_column :domain_blocks, :hidden_anonymous
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
safety_assured do
|
||||||
|
add_column :domain_blocks, :hidden_anonymous, :boolean, null: false, default: false
|
||||||
|
end
|
||||||
|
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: 2023_12_22_100226) do
|
ActiveRecord::Schema[7.1].define(version: 2024_01_09_035435) 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"
|
||||||
|
|
||||||
|
@ -584,7 +584,6 @@ ActiveRecord::Schema[7.1].define(version: 2023_12_22_100226) do
|
||||||
t.boolean "reject_straight_follow", default: false, null: false
|
t.boolean "reject_straight_follow", default: false, null: false
|
||||||
t.boolean "reject_new_follow", default: false, null: false
|
t.boolean "reject_new_follow", default: false, null: false
|
||||||
t.boolean "hidden", default: false, null: false
|
t.boolean "hidden", default: false, null: false
|
||||||
t.boolean "hidden_anonymous", default: false, null: false
|
|
||||||
t.boolean "detect_invalid_subscription", default: false, null: false
|
t.boolean "detect_invalid_subscription", default: false, null: false
|
||||||
t.boolean "reject_reply_exclude_followers", default: false, null: false
|
t.boolean "reject_reply_exclude_followers", default: false, null: false
|
||||||
t.boolean "reject_friend", default: false, null: false
|
t.boolean "reject_friend", default: false, null: false
|
||||||
|
|
|
@ -37,16 +37,6 @@ RSpec.describe 'Domain Blocks' do
|
||||||
expect(body_as_json.pluck(:domain)).to_not include('hello.com')
|
expect(body_as_json.pluck(:domain)).to_not include('hello.com')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with hidden domain block from anonymous' do
|
|
||||||
before { Fabricate(:domain_block, domain: 'hello.com', hidden_anonymous: true) }
|
|
||||||
|
|
||||||
it 'returns http success and dont include hidden record' do
|
|
||||||
get api_v1_instance_domain_blocks_path
|
|
||||||
|
|
||||||
expect(body_as_json.pluck(:domain)).to_not include('hello.com')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with domain blocks set to users' do
|
context 'with domain blocks set to users' do
|
||||||
|
@ -84,16 +74,6 @@ RSpec.describe 'Domain Blocks' do
|
||||||
expect(body_as_json.pluck(:domain)).to_not include('hello.com')
|
expect(body_as_json.pluck(:domain)).to_not include('hello.com')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with hidden domain block from anonymous' do
|
|
||||||
before { Fabricate(:domain_block, domain: 'hello.com', hidden_anonymous: true) }
|
|
||||||
|
|
||||||
it 'returns http success and dont include hidden record' do
|
|
||||||
get api_v1_instance_domain_blocks_path, headers: headers
|
|
||||||
|
|
||||||
expect(body_as_json.pluck(:domain)).to_not include('hello.com')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with domain blocks set to disabled' do
|
context 'with domain blocks set to disabled' do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue