FEATURE: clean API method for reading a single notification

This commit is contained in:
Sam
2016-09-16 16:14:00 +10:00
parent 0290619669
commit 75f3f7fcbd
5 changed files with 34 additions and 9 deletions

View File

@ -172,10 +172,7 @@ class ApplicationController < ActionController::Base
if notifications.present?
notification_ids = notifications.split(",").map(&:to_i)
count = Notification.where(user_id: current_user.id, id: notification_ids, read: false).update_all(read: true)
if count > 0
current_user.publish_notifications_state
end
Notification.read(current_user, notification_ids)
cookies.delete('cn')
end
end