mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 04:27:56 +08:00
FEATURE: defer flags when deleting child replies (#7111)
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user