mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 18:24:52 -06:00
FIX: Load user model when some attributes are missing.
Follow-up to 3ad07aacfa
.
This commit is contained in:
parent
ab53b485b4
commit
2f54dd5e3d
@ -218,8 +218,12 @@ class Notification < ActiveRecord::Base
|
|||||||
|
|
||||||
def refresh_notification_count
|
def refresh_notification_count
|
||||||
begin
|
begin
|
||||||
user.notifications.reset
|
if user.has_attribute?(:seen_notification_id)
|
||||||
user.publish_notifications_state
|
user.notifications.reset
|
||||||
|
user.publish_notifications_state
|
||||||
|
else
|
||||||
|
User.find_by(id: user.id).publish_notifications_state
|
||||||
|
end
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
# happens when we delete a user
|
# happens when we delete a user
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user