FEATURE: defer flags when deleting child replies (#7111)

This commit is contained in:
Arpit Jalan
2019-03-06 14:32:25 +05:30
committed by GitHub
parent b2187301fd
commit 05ebb52ec4
5 changed files with 20 additions and 9 deletions

View File

@ -248,15 +248,22 @@ describe PostsController do
let(:moderator) { Fabricate(:moderator) }
before do
sign_in(moderator)
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)
it "defers the child posts by default" do
expect(PostAction.flagged_posts_count).to eq(2)
delete "/posts/destroy_many.json", params: { post_ids: [post1.id, post2.id], defer_flags: true }
delete "/posts/destroy_many.json", params: { post_ids: [post1.id, post2.id] }
expect(Jobs::SendSystemMessage.jobs.size).to eq(1)
expect(PostAction.flagged_posts_count).to eq(0)
end
it "can defer all posts based on `agree_with_first_reply_flag` param" do
expect(PostAction.flagged_posts_count).to eq(2)
delete "/posts/destroy_many.json", params: { post_ids: [post1.id, post2.id], agree_with_first_reply_flag: false }
expect(Jobs::SendSystemMessage.jobs.size).to eq(0)
expect(PostAction.flagged_posts_count).to eq(0)
end