diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-11-23 23:10:05 -0600 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-11-23 23:10:05 -0600 |
commit | 65a9abb315f18ac777f3d0e09b3f7399830ad243 (patch) | |
tree | 39712b50201749efad11dce09561d81f4bdcdb2f /app/policies | |
parent | 7f5ba917563aa1c9a373d9dd3a6a29f73d81ee9a (diff) |
Add user options to disable recipient verification, allow anonymous public access; rework private mode
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/status_policy.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/policies/status_policy.rb b/app/policies/status_policy.rb index 56c217cec..c16ec29ed 100644 --- a/app/policies/status_policy.rb +++ b/app/policies/status_policy.rb @@ -18,10 +18,12 @@ class StatusPolicy < ApplicationPolicy if requires_mention? owned? || mention_exists? + elsif author.private? && public? + !(author_blocking? || author_blocking_domain?) elsif private? owned? || following_author? || mention_exists? else - current_account.nil? || (!author_blocking? && !author_blocking_domain?) + current_account.nil? || !(author_blocking? || author_blocking_domain?) end end @@ -80,7 +82,7 @@ class StatusPolicy < ApplicationPolicy end def author_blocking? - return author.require_auth? if current_account.nil? + return false if current_account.nil? @preloaded_relations[:blocked_by] ? @preloaded_relations[:blocked_by][author.id] : author.blocking?(current_account) end @@ -94,7 +96,7 @@ class StatusPolicy < ApplicationPolicy def author record.account end - + def local_only? record.local_only? end @@ -103,6 +105,10 @@ class StatusPolicy < ApplicationPolicy record.published? end + def public? + record.public_visibility? || record.unlisted_visibility? + end + def visibility_for_remote_domain @visibility_for_domain ||= record.visibility_for_domain(current_account&.domain) end |