A platform for community discussion. Free, open, simple.
FIX: Clear notification of skipped narrative bot PM (#10792)
Penar Musarajd6038ac666a9
diff --git a/plugins/discourse-narrative-bot/plugin.rb b/plugins/discourse-narrative-bot/plugin.rbindex b6c72c64530..98c2f41db2f 100644--- a/plugins/discourse-narrative-bot/plugin.rb+++ b/plugins/discourse-narrative-bot/plugin.rb@@ -194,6 +194,15 @@ after_initialize doreturn 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).destroyDiscourseNarrativeBot::Store.remove(self.id)enddiff --git a/plugins/discourse-narrative-bot/spec/user_spec.rb b/plugins/discourse-narrative-bot/spec/user_spec.rbindex 3e514cc4aee..f775dd71110 100644--- a/plugins/discourse-narrative-bot/spec/user_spec.rb+++ b/plugins/discourse-narrative-bot/spec/user_spec.rb@@ -123,6 +123,8 @@ describe User douser.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)endend