about summary refs log tree commit diff
path: root/app/policies
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-07-17 01:53:37 +0200
committerEugen Rochko <eugen@zeonfederated.com>2019-07-17 01:53:37 +0200
commit5599caef49962ec62c8a557273f4eebb0f94767e (patch)
tree54748577fb2f7246282088386e74a0ee7a491b62 /app/policies
parent15ddabf95a34d834295484d7e4ee21515e6fc9da (diff)
Extend AUTHORIZED_FETCH mode to user blocks as well (#11332)
* Extend AUTHORIZED_FETCH mode to user blocks as well

* Move decision to deny access to StatusPolicy
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/status_policy.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/policies/status_policy.rb b/app/policies/status_policy.rb
index 64a5111fc..118b79f3e 100644
--- a/app/policies/status_policy.rb
+++ b/app/policies/status_policy.rb
@@ -17,7 +17,7 @@ class StatusPolicy < ApplicationPolicy
     elsif private?
       owned? || following_author? || mention_exists?
     else
-      current_account.nil? || !author_blocking?
+      current_account.nil? || (!author_blocking? && !author_blocking_domain?)
     end
   end
 
@@ -63,6 +63,12 @@ class StatusPolicy < ApplicationPolicy
     end
   end
 
+  def author_blocking_domain?
+    return false if current_account.nil? || current_account.domain.nil?
+
+    author.blocking_domain?(current_account.domain)
+  end
+
   def blocking_author?
     return false if current_account.nil?