Block domain with status policy
This commit is contained in:
parent
6c37e35c84
commit
d47c89055f
1 changed files with 15 additions and 1 deletions
|
@ -18,7 +18,7 @@ class StatusPolicy < ApplicationPolicy
|
||||||
elsif private?
|
elsif private?
|
||||||
owned? || following_author? || mention_exists?
|
owned? || following_author? || mention_exists?
|
||||||
else
|
else
|
||||||
current_account.nil? || (!author_blocking? && !author_blocking_domain?)
|
current_account.nil? || (!author_blocking? && !author_blocking_domain? && !server_blocking_domain?)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -99,4 +99,18 @@ class StatusPolicy < ApplicationPolicy
|
||||||
def author
|
def author
|
||||||
record.account
|
record.account
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def server_blocking_domain?
|
||||||
|
@domain_block = DomainBlock.find_by(domain: current_account&.domain)
|
||||||
|
if @domain_block
|
||||||
|
(@domain_block.reject_send_not_public_searchability && record.compute_searchability != 'public') ||
|
||||||
|
(@domain_block.reject_send_unlisted_dissubscribable && record.unlisted_visibility? && record.account.dissubscribable) ||
|
||||||
|
(@domain_block.reject_send_public_unlisted && record.public_unlisted_visibility?) ||
|
||||||
|
(@domain_block.reject_send_dissubscribable && record.account.dissubscribable) ||
|
||||||
|
(@domain_block.reject_send_media && record.with_media?) ||
|
||||||
|
(@domain_block.reject_send_sensitive && ((record.with_media? && record.sensitive) || record.spoiler_text))
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue