Add reject public unlisted subscription configs

This commit is contained in:
KMY 2023-04-30 21:36:49 +09:00
parent ae4da45054
commit 7d3d93e9a4
21 changed files with 63 additions and 22 deletions

View file

@ -53,6 +53,7 @@
# group_allow_private_message :boolean
# searchability :integer default("private"), not null
# dissubscribable :boolean default(FALSE), not null
# stop_emoji_reaction_streaming :boolean default(FALSE)
#
class Account < ApplicationRecord

View file

@ -27,8 +27,8 @@ class AccountStatusesFilter
scope.merge!(hashtag_scope) if tagged?
scope.merge!(scope.where(searchability: :public)) if domain_block&.reject_send_not_public_searchability
scope.merge!(scope.where.not(visibility: :unlisted)) if domain_block&.reject_send_unlisted_dissubscribable && @account.dissubscribable
scope.merge!(scope.where.not(visibility: :public_unlisted)) if domain_block&.reject_send_public_unlisted
scope.merge!(scope.where.not(visibility: :public_unlisted)) if domain_block&.reject_send_public_unlisted || (domain_block&.detect_invalid_subscription && @account.user&.setting_reject_public_unlisted_subscription)
scope.merge!(scope.where.not(visibility: :unlisted)) if domain_block&.detect_invalid_subscription && @account.user&.setting_unlisted_subscription
scope.merge!(scope.where(spoiler_text: ['', nil])) if domain_block&.reject_send_sensitive
scope

View file

@ -17,7 +17,6 @@
# reject_favourite :boolean default(FALSE), not null
# reject_reply :boolean default(FALSE), not null
# reject_send_not_public_searchability :boolean default(FALSE), not null
# reject_send_unlisted_dissubscribable :boolean default(FALSE), not null
# reject_send_public_unlisted :boolean default(FALSE), not null
# reject_send_dissubscribable :boolean default(FALSE), not null
# reject_send_media :boolean default(FALSE), not null
@ -27,6 +26,7 @@
# reject_new_follow :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
#
class DomainBlock < ApplicationRecord
@ -59,7 +59,6 @@ class DomainBlock < ApplicationRecord
reject_favourite? ? :reject_favourite : nil,
reject_reply? ? :reject_reply : nil,
reject_send_not_public_searchability? ? :reject_send_not_public_searchability : nil,
reject_send_unlisted_dissubscribable? ? :reject_send_unlisted_dissubscribable : nil,
reject_send_public_unlisted? ? :reject_send_public_unlisted : nil,
reject_send_dissubscribable? ? :reject_send_dissubscribable : nil,
reject_send_media? ? :reject_send_media : nil,
@ -67,6 +66,7 @@ class DomainBlock < ApplicationRecord
reject_hashtag? ? :reject_hashtag : nil,
reject_straight_follow? ? :reject_straight_follow : nil,
reject_new_follow? ? :reject_new_follow : nil,
detect_invalid_subscription? ? :detect_invalid_subscription : nil,
reject_reports? ? :reject_reports : nil
].reject { |policy| policy == :noop || policy.nil? }
end

View file

@ -138,6 +138,7 @@ class User < ApplicationRecord
:expand_spoilers, :default_language, :aggregate_reblogs, :show_application,
:advanced_layout, :use_blurhash, :use_pending_items, :trends, :crop_images,
:disable_swiping, :always_send_emails, :public_post_to_unlisted,
:reject_public_unlisted_subscription, :reject_unlisted_subscription,
to: :settings, prefix: :setting, allow_nil: false
delegate :can?, to: :role