mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 20:33:38 +08:00
FIX: Clear notification of skipped narrative bot PM (#10792)
Resets a new user's PM count in their badge after skipping user tips.
This commit is contained in:
parent
5cf411c3ae
commit
d6038ac666
|
@ -194,6 +194,15 @@ after_initialize do
|
|||
return if topic.blank?
|
||||
|
||||
first_post = topic.ordered_posts.first
|
||||
|
||||
notification = Notification.where(topic_id: topic.id, post_number: first_post.post_number).first
|
||||
if notification.present?
|
||||
Notification.read(self, notification.id)
|
||||
self.saw_notification_id(notification.id)
|
||||
self.reload
|
||||
self.publish_notifications_state
|
||||
end
|
||||
|
||||
PostDestroyer.new(Discourse.system_user, first_post, skip_staff_log: true).destroy
|
||||
DiscourseNarrativeBot::Store.remove(self.id)
|
||||
end
|
||||
|
|
|
@ -123,6 +123,8 @@ describe User do
|
|||
user.user_option.save!
|
||||
}.to change { Topic.count }.by(-1)
|
||||
.and change { UserHistory.count }.by(0)
|
||||
.and change { user.unread_high_priority_notifications }.by(-1)
|
||||
.and change { user.notifications.count }.by(-1)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user