diff --git a/app/jobs/regular/process_post.rb b/app/jobs/regular/process_post.rb index 1230dbc7526..8a9cba11bb3 100644 --- a/app/jobs/regular/process_post.rb +++ b/app/jobs/regular/process_post.rb @@ -41,7 +41,7 @@ module Jobs if !post.user.staff? && !post.user.staged s = post.cooked s << " #{post.topic.title}" if post.post_number == 1 - if WordWatcher.new(s).should_flag? + if !args[:bypass_bump] && WordWatcher.new(s).should_flag? PostAction.act(Discourse.system_user, post, PostActionType.types[:inappropriate]) rescue PostAction::AlreadyActed end end diff --git a/spec/integration/watched_words_spec.rb b/spec/integration/watched_words_spec.rb index bfef752a6de..03034e9b441 100644 --- a/spec/integration/watched_words_spec.rb +++ b/spec/integration/watched_words_spec.rb @@ -169,5 +169,13 @@ describe WatchedWord do }.to change { PostAction.count }.by(1) expect(PostAction.where(post_id: post.id, post_action_type_id: PostActionType.types[:inappropriate]).exists?).to eq(true) end + + it "should not flag on rebake" do + post = Fabricate(:post, topic: Fabricate(:topic, user: tl2_user), user: tl2_user, raw: "I have coupon codes. Message me.") + Fabricate(:watched_word, action: WatchedWord.actions[:flag], word: "coupon") + expect { + post.rebake! + }.to_not change { PostAction.count } + end end end