mirror of
https://github.com/discourse/discourse.git
synced 2025-06-07 17:34:39 +08:00
FIX: Load user model when some attributes are missing.
Follow-up to 3ad07aacfaab57aa458b43c3896ccb805bb26722.
This commit is contained in:
@ -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
|
||||||
|
Reference in New Issue
Block a user