A platform for community discussion. Free, open, simple.
FIX: Check if tags edit notifications are disabled (#17499)
Bianca Nenciue8d802eb86bb
diff --git a/lib/post_revisor.rb b/lib/post_revisor.rbindex 03e3ede96bc..7a2ac7f3517 100644--- a/lib/post_revisor.rb+++ b/lib/post_revisor.rb@@ -113,7 +113,7 @@ class PostRevisorDB.after_commit dopost = tc.topic.ordered_posts.firstnotified_user_ids = [post.user_id, post.last_editor_id].uniq- Jobs.enqueue(:notify_tag_change, post_id: post.id, notified_user_ids: notified_user_ids, diff_tags: ((tags - prev_tags) | (prev_tags - tags)))+ Jobs.enqueue(:notify_tag_change, post_id: post.id, notified_user_ids: notified_user_ids, diff_tags: ((tags - prev_tags) | (prev_tags - tags))) if !SiteSetting.disable_tags_edit_notificationsendendenddiff --git a/spec/lib/post_revisor_spec.rb b/spec/lib/post_revisor_spec.rbindex d483119cdb9..19d2d20573d 100644--- a/spec/lib/post_revisor_spec.rb+++ b/spec/lib/post_revisor_spec.rb@@ -124,6 +124,34 @@ describe PostRevisor doendend+ context 'editing tags' do+ fab!(:post) { Fabricate(:post) }++ subject { PostRevisor.new(post) }++ before do+ Jobs.run_immediately!++ TopicUser.change(+ newuser.id,+ post.topic_id,+ notification_level: TopicUser.notification_levels[:watching]+ )+ end++ it 'creates notifications' do+ expect { subject.revise!(admin, tags: ['new-tag']) }+ .to change { Notification.count }.by(1)+ end++ it 'skips notifications if disable_tags_edit_notifications' do+ SiteSetting.disable_tags_edit_notifications = true++ expect { subject.revise!(admin, tags: ['new-tag']) }+ .to change { Notification.count }.by(0)+ end+ end+context 'revise wiki' dobefore do