fix: Unread notification count in multiple accounts (#4373)

Fixes: #4367
This commit is contained in:
Muhsin Keloth
2022-04-04 14:34:01 +05:30
committed by GitHub
parent 3509692055
commit 1dd0c7249c
2 changed files with 6 additions and 5 deletions

View File

@@ -188,10 +188,10 @@ class User < ApplicationRecord
mutations_from_database.changed?('email')
end
def notifications_meta
def notifications_meta(account_id)
{
unread_count: notifications.where(read_at: nil).count,
count: notifications.count
unread_count: notifications.where(account_id: account_id, read_at: nil).count,
count: notifications.where(account_id: account_id).count
}
end
end