FIX: badge notifications are marked read by the system after opening

This commit is contained in:
Sam 2014-10-02 16:03:56 +10:00
parent 72a28aeb7c
commit 37af13f6ea
1 changed files with 5 additions and 1 deletions

View File

@ -255,8 +255,12 @@ class User < ActiveRecord::Base
end
def saw_notification_id(notification_id)
User.where(["id = ? and seen_notification_id < ?", id, notification_id])
User.where("id = ? and seen_notification_id < ?", id, notification_id)
.update_all ["seen_notification_id = ?", notification_id]
# mark all badge notifications read
Notification.where('user_id = ? AND NOT read AND notification_type = ?', id, Notification.types[:granted_badge])
.update_all ["read = ?", true]
end
def publish_notifications_state