FIX: defer flags (only) when handling a flag and deleting replies (#6702)

This commit is contained in:
Arpit Jalan
2018-11-29 22:44:18 +05:30
committed by GitHub
parent 4a8f21d387
commit 40f10855c6
6 changed files with 52 additions and 22 deletions

View File

@ -243,6 +243,24 @@ describe PostsController do
delete "/posts/destroy_many.json", params: { post_ids: [post1.id], reply_post_ids: [post1.id] }
end
end
context "deleting flagged posts" do
let(:moderator) { Fabricate(:moderator) }
before do
PostAction.act(moderator, post1, PostActionType.types[:off_topic])
PostAction.act(moderator, post2, PostActionType.types[:off_topic])
Jobs::SendSystemMessage.clear
end
it "defers the posts" do
sign_in(moderator)
expect(PostAction.flagged_posts_count).to eq(2)
delete "/posts/destroy_many.json", params: { post_ids: [post1.id, post2.id], defer_flags: true }
expect(Jobs::SendSystemMessage.jobs.size).to eq(0)
expect(PostAction.flagged_posts_count).to eq(0)
end
end
end
end