A platform for community discussion. Free, open, simple.
FIX: system user edits should not generate notifications
Régis Hanolb2f18fc98fce
diff --git a/lib/post_revisor.rb b/lib/post_revisor.rbindex 6e0c35c6ba9..3dd2db5f4f8 100644--- a/lib/post_revisor.rb+++ b/lib/post_revisor.rb@@ -483,6 +483,7 @@ class PostRevisorenddef alert_users+ return if @editor.id == Discourse::SYSTEM_USER_IDPostAlerter.new.after_save_post(@post)enddiff --git a/spec/components/post_revisor_spec.rb b/spec/components/post_revisor_spec.rbindex 44d26f91076..84b64825b07 100644--- a/spec/components/post_revisor_spec.rb+++ b/spec/components/post_revisor_spec.rb@@ -451,6 +451,24 @@ describe PostRevisor doendend+ context "alerts" do++ let(:mentioned_user) { Fabricate(:user) }++ it "generates a notification for a mention" do+ expect {+ subject.revise!(Fabricate(:user), raw: "Random user is mentioning @#{mentioned_user.username_lower}")+ }.to change { Notification.where(notification_type: Notification.types[:mentioned]).count }+ end++ it "never generates a notification for a mention when the System user revise a post" do+ expect {+ subject.revise!(Discourse.system_user, raw: "System user is mentioning @#{mentioned_user.username_lower}")+ }.not_to change { Notification.where(notification_type: Notification.types[:mentioned]).count }+ end++ end+context "tagging" docontext "tagging disabled" dobefore do