From 338d39265a7a5de2e5c818d14c5cecb7e63ca790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Sat, 26 May 2018 02:27:54 +0200 Subject: [PATCH] FIX: don't publish notifications_state when user has been deleted --- app/models/notification.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/notification.rb b/app/models/notification.rb index 73efa0a510d..fc67f394812 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -201,7 +201,11 @@ class Notification < ActiveRecord::Base protected def refresh_notification_count - user.reload.publish_notifications_state + begin + user.reload.publish_notifications_state + rescue ActiveRecord::RecordNotFound + # happens when we delete a user + end end def send_email