mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 02:11:08 -06:00
FIX: system user edits should not generate notifications
This commit is contained in:
parent
aab2d102ff
commit
b2f18fc98f
@ -483,6 +483,7 @@ class PostRevisor
|
|||||||
end
|
end
|
||||||
|
|
||||||
def alert_users
|
def alert_users
|
||||||
|
return if @editor.id == Discourse::SYSTEM_USER_ID
|
||||||
PostAlerter.new.after_save_post(@post)
|
PostAlerter.new.after_save_post(@post)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -451,6 +451,24 @@ describe PostRevisor do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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" do
|
context "tagging" do
|
||||||
context "tagging disabled" do
|
context "tagging disabled" do
|
||||||
before do
|
before do
|
||||||
|
Loading…
Reference in New Issue
Block a user