about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-09-11 15:16:29 +0200
committerGitHub <noreply@github.com>2020-09-11 15:16:29 +0200
commite6b272e5c9c227cfbbe375a893f567c5967d669c (patch)
tree83aa2fe629cc54225531852fe7020388277ba040 /app/models
parente6d67f85e288a5c3137c9fc09f99c9051544d87c (diff)
Change REST API to return empty data for suspended accounts (#14765)
Diffstat (limited to 'app/models')
-rw-r--r--app/models/notification.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/notification.rb b/app/models/notification.rb
index ad7528f50..4d7a392b1 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -41,8 +41,11 @@ class Notification < ApplicationRecord
   validates :account_id, uniqueness: { scope: [:activity_type, :activity_id] }
   validates :activity_type, inclusion: { in: TYPE_CLASS_MAP.values }
 
+  scope :without_suspended, -> { joins(:from_account).merge(Account.without_suspended) }
+
   scope :browserable, ->(exclude_types = [], account_id = nil) {
     types = TYPE_CLASS_MAP.values - activity_types_from_types(exclude_types)
+
     if account_id.nil?
       where(activity_type: types)
     else