FIX: remove notifications on deleted topics from the stream

This commit is contained in:
Sam
2015-02-19 12:40:00 +11:00
parent 59a28bf5c1
commit 67f404d281
3 changed files with 18 additions and 7 deletions

View File

@ -237,7 +237,7 @@ class User < ActiveRecord::Base
end
def unread_notifications_by_type
@unread_notifications_by_type ||= notifications.where("id > ? and read = false", seen_notification_id).group(:notification_type).count
@unread_notifications_by_type ||= notifications.visible.where("id > ? and read = false", seen_notification_id).group(:notification_type).count
end
def reload
@ -248,7 +248,7 @@ class User < ActiveRecord::Base
end
def unread_private_messages
@unread_pms ||= notifications.where("read = false AND notification_type = ?", Notification.types[:private_message]).count
@unread_pms ||= notifications.visible.where("read = false AND notification_type = ?", Notification.types[:private_message]).count
end
def unread_notifications