From d0337e7f5efff93cdf571c5ef78103f242a92607 Mon Sep 17 00:00:00 2001 From: Sam <sam.saffron@gmail.com> Date: Mon, 22 Feb 2016 12:20:41 +1100 Subject: [PATCH] FIX: clear notification bubble when notification is read --- app/controllers/application_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6dd3f81ad..b36e02ccd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -154,7 +154,10 @@ class ApplicationController < ActionController::Base if notifications.present? notification_ids = notifications.split(",").map(&:to_i) - Notification.where(user_id: current_user.id, id: notification_ids).update_all(read: true) + 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 cookies.delete('cn') end end