Skip to content

Commit

Permalink
FIX: badge notifications are marked read by the system after opening
Browse files Browse the repository at this point in the history
  • Loading branch information
SamSaffron committed Oct 2, 2014
1 parent 72a28ae commit 37af13f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,12 @@ def unread_notifications
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
Expand Down

0 comments on commit 37af13f

Please sign in to comment.