about summary refs log tree commit diff
path: root/app/policies
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-07-25 23:19:56 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:45:15 -0500
commit70763ef0ea6cb6b997ac144d8b4d855b16fb838c (patch)
tree22188b8531085b35652f5459fc04e84384d1a231 /app/policies
parent3c6057034eea75f1992c9d2f2b2c2e401858bdc7 (diff)
[Feature, Privacy] Add base support for per-domain post privacy
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/status_policy.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/policies/status_policy.rb b/app/policies/status_policy.rb
index bec58c39f..69d18c4bf 100644
--- a/app/policies/status_policy.rb
+++ b/app/policies/status_policy.rb
@@ -45,7 +45,7 @@ class StatusPolicy < ApplicationPolicy
   private
 
   def requires_mention?
-    record.direct_visibility? || record.limited_visibility?
+    %w(direct limited).include?(visibility_for_remote_domain)
   end
 
   def owned?
@@ -53,7 +53,7 @@ class StatusPolicy < ApplicationPolicy
   end
 
   def private?
-    record.private_visibility? || !public_conversation?
+    visibility_for_remote_domain == 'private' || !public_conversation?
   end
 
   def mention_exists?
@@ -164,4 +164,8 @@ class StatusPolicy < ApplicationPolicy
   def public_conversation?
     @public_conversation ||= (record.conversation&.public? || false)
   end
+
+  def visibility_for_remote_domain
+    @visibility_for_domain ||= record.visibility_for_domain(current_account&.domain)
+  end
 end