FIX: don't send PM if flagged post is deleted but flags were deferred or cleared

This commit is contained in:
Neil Lalonde
2018-07-26 15:12:12 -04:00
parent 330cf78c83
commit 135c803f49
3 changed files with 34 additions and 3 deletions

View File

@@ -606,6 +606,16 @@ describe PostDestroyer do
Topic.where(title: I18n.t('system_messages.flags_agreed_and_post_deleted.subject_template')).exists?
).to eq(false)
end
it "should not send the flags_agreed_and_post_deleted message if flags were deferred" do
second_post.expects(:update_flagged_posts_count)
PostAction.defer_flags!(second_post, moderator)
second_post.reload
PostDestroyer.new(moderator, second_post).destroy
expect(
Topic.where(title: I18n.t('system_messages.flags_agreed_and_post_deleted.subject_template')).exists?
).to eq(false)
end
end
describe "user actions" do