FIX: Reload only notifications when refreshing notification count (#8221)

Previously, we used to reload the whole User instance which discarded
any changes made (for example setting 'unstage' to false).
This commit is contained in:
Dan Ungureanu
2019-10-21 20:25:46 +03:00
committed by GitHub
parent 1358312584
commit 3ad07aacfa
2 changed files with 9 additions and 6 deletions

View File

@@ -218,7 +218,8 @@ class Notification < ActiveRecord::Base
def refresh_notification_count
begin
user.reload.publish_notifications_state
user.notifications.reset
user.publish_notifications_state
rescue ActiveRecord::RecordNotFound
# happens when we delete a user
end