]> cat aescling's git repositories - mastodon.git/commitdiff
Extend AUTHORIZED_FETCH mode to user blocks as well (#11332)
authorThibG <thib@sitedethib.com>
Tue, 16 Jul 2019 23:53:37 +0000 (01:53 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Tue, 16 Jul 2019 23:53:37 +0000 (01:53 +0200)
* Extend AUTHORIZED_FETCH mode to user blocks as well

* Move decision to deny access to StatusPolicy

app/policies/status_policy.rb

index 64a5111fc8f899bbb9e4de6b7da99ee3281f70eb..118b79f3ed482f803ce2af3272cdc9cf05a06984 100644 (file)
@@ -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?