From e6b272e5c9c227cfbbe375a893f567c5967d669c Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 11 Sep 2020 15:16:29 +0200 Subject: Change REST API to return empty data for suspended accounts (#14765) --- app/models/notification.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app/models/notification.rb') 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 -- cgit