about summary refs log tree commit diff
path: root/app/policies
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-09-30 12:25:13 -0500
committerFire Demon <firedemon@creature.cafe>2020-09-30 12:25:13 -0500
commit22e7a7947900cc974715b0c9d1d6b1a44d2ed1eb (patch)
tree918ab95c4f465c9c1fbfcd6706483e3310a38ce5 /app/policies
parent63046c8cb9df8e797d53566f2050313d757b089b (diff)
parentb5edf30160eab3776e44b34325a4ea00d9f71dc5 (diff)
Merge remote-tracking branch 'upstream/master' into merge-glitch
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/account_policy.rb4
-rw-r--r--app/policies/status_policy.rb21
2 files changed, 9 insertions, 16 deletions
diff --git a/app/policies/account_policy.rb b/app/policies/account_policy.rb
index 9c145979d..1b105e92a 100644
--- a/app/policies/account_policy.rb
+++ b/app/policies/account_policy.rb
@@ -17,6 +17,10 @@ class AccountPolicy < ApplicationPolicy
     staff? && !record.user&.staff?
   end
 
+  def destroy?
+    record.suspended? && record.deletion_request.present? && admin?
+  end
+
   def unsuspend?
     staff?
   end
diff --git a/app/policies/status_policy.rb b/app/policies/status_policy.rb
index db600fe40..56c217cec 100644
--- a/app/policies/status_policy.rb
+++ b/app/policies/status_policy.rb
@@ -12,15 +12,16 @@ class StatusPolicy < ApplicationPolicy
   end
 
   def show?
+    return false if author.suspended?
     return false if local_only? && !current_account&.local?
     return false unless published? || owned?
 
     if requires_mention?
       owned? || mention_exists?
     elsif private?
-      owned? || following_owners? || mention_exists?
+      owned? || following_author? || mention_exists?
     else
-      current_account.nil? || !blocked_by_owners?
+      current_account.nil? || (!author_blocking? && !author_blocking_domain?)
     end
   end
 
@@ -84,24 +85,16 @@ class StatusPolicy < ApplicationPolicy
     @preloaded_relations[:blocked_by] ? @preloaded_relations[:blocked_by][author.id] : author.blocking?(current_account)
   end
 
-  def blocked_by_owners?
-    author_blocking? || author_blocking_domain?
-  end
-
   def following_author?
     return false if current_account.nil?
 
     @preloaded_relations[:following] ? @preloaded_relations[:following][author.id] : current_account.following?(author)
   end
 
-  def following_owners?
-    following_author?
-  end
-
   def author
-    @author ||= record.account
+    record.account
   end
-
+  
   def local_only?
     record.local_only?
   end
@@ -110,10 +103,6 @@ class StatusPolicy < ApplicationPolicy
     record.published?
   end
 
-  def reply?
-    record.reply? && record.in_reply_to_account_id != author.id
-  end
-
   def visibility_for_remote_domain
     @visibility_for_domain ||= record.visibility_for_domain(current_account&.domain)
   end