about summary refs log tree commit diff
path: root/app/models/status.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-03-02 18:50:33 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-03-02 18:50:33 +0100
commit4c0e9f85c5c9e3be91f9a76139fab3b55abbf363 (patch)
tree9d60c6b37a6adb60b20a674630587de4e55d8765 /app/models/status.rb
parent89fc2d7f4810ecdf66b17543f4603c1089a0c3f5 (diff)
parentc64a1c25c4e9a07c694863a38334ed66e368752e (diff)
Merge branch 'KitRedgrave-add-mute-button'
Diffstat (limited to 'app/models/status.rb')
-rw-r--r--app/models/status.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index 1b40897f3..e5e740360 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -168,9 +168,9 @@ class Status < ApplicationRecord
     private
 
     def filter_timeline(query, account)
-      blocked = Block.where(account: account).pluck(:target_account_id) + Block.where(target_account: account).pluck(:account_id)
-      query   = query.where('statuses.account_id NOT IN (?)', blocked) unless blocked.empty?
-      query   = query.where('accounts.silenced = TRUE') if account.silenced?
+      blocked = Block.where(account: account).pluck(:target_account_id) + Block.where(target_account: account).pluck(:account_id) + Mute.where(account: account).pluck(:target_account_id)
+      query   = query.where('statuses.account_id NOT IN (?)', blocked) unless blocked.empty?  # Only give us statuses from people we haven't blocked, or muted, or that have blocked us
+      query   = query.where('accounts.silenced = TRUE') if account.silenced?                  # and if we're hellbanned, only people who are also hellbanned
       query
     end
 
@@ -192,6 +192,6 @@ class Status < ApplicationRecord
   private
 
   def filter_from_context?(status, account)
-    account&.blocking?(status.account_id) || (status.account.silenced? && !account&.following?(status.account_id)) || !status.permitted?(account)
+    account&.blocking?(status.account_id) || account&.muting?(status.account_id) || (status.account.silenced? && !account&.following?(status.account_id)) || !status.permitted?(account)
   end
 end