FEATURE: Add a radial ping when user's first notification has not been read.

This commit is contained in:
Guo Xiang Tan
2016-11-08 16:12:40 +08:00
parent ac2c035856
commit a8b7599d4a
7 changed files with 71 additions and 2 deletions

View File

@ -343,6 +343,10 @@ class User < ActiveRecord::Base
end
end
def read_first_notification?
notifications.order(created_at: :asc).first.read
end
def publish_notifications_state
# publish last notification json with the message so we
# can apply an update
@ -384,6 +388,7 @@ class User < ActiveRecord::Base
{unread_notifications: unread_notifications,
unread_private_messages: unread_private_messages,
total_unread_notifications: total_unread_notifications,
read_first_notification: read_first_notification?,
last_notification: json,
recent: recent,
seen_notification_id: seen_notification_id