FIX: Track first notification read using Redis.

This commit is contained in:
Guo Xiang Tan
2016-11-16 16:20:38 +08:00
parent c4e3ab21dd
commit 98c1e0832c
3 changed files with 54 additions and 10 deletions

View File

@ -55,7 +55,10 @@ class Notification < ActiveRecord::Base
read: false)
.update_all("read = 't'")
user.publish_notifications_state if count > 0
if count > 0
user.mark_first_notification_read
user.publish_notifications_state
end
count
end
@ -64,7 +67,9 @@ class Notification < ActiveRecord::Base
count = Notification.where(user_id: user.id,
id: notification_ids,
read: false).update_all(read: true)
if count > 0
user.mark_first_notification_read
user.publish_notifications_state
end
end