mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Revert "FIX: do not agree flags by default when deleting posts"
This reverts commit cb6fc8057b.
This commit is contained in:
@@ -632,13 +632,13 @@ describe PostDestroyer do
|
||||
let!(:flag) { PostAction.act(moderator, second_post, PostActionType.types[:off_topic]) }
|
||||
|
||||
before do
|
||||
Jobs::SendSystemMessage.clear
|
||||
SiteSetting.queue_jobs = false
|
||||
end
|
||||
|
||||
it "should delete public post actions and agree with flags" do
|
||||
second_post.expects(:update_flagged_posts_count)
|
||||
|
||||
PostDestroyer.new(moderator, second_post, agree_flags: true).destroy
|
||||
PostDestroyer.new(moderator, second_post).destroy
|
||||
|
||||
expect(PostAction.find_by(id: bookmark.id)).to eq(nil)
|
||||
|
||||
@@ -650,39 +650,36 @@ describe PostDestroyer do
|
||||
expect(second_post.bookmark_count).to eq(0)
|
||||
expect(second_post.off_topic_count).to eq(1)
|
||||
|
||||
expect(Jobs::SendSystemMessage.jobs.size).to eq(1)
|
||||
notification = second_post.user.notifications.where(notification_type: Notification.types[:private_message]).last
|
||||
expect(notification).to be_present
|
||||
expect(notification.topic.title).to eq(I18n.t('system_messages.flags_agreed_and_post_deleted.subject_template'))
|
||||
end
|
||||
|
||||
it "should not send the flags_agreed_and_post_deleted message if it was deleted by system" do
|
||||
expect(PostAction.flagged_posts_count).to eq(1)
|
||||
PostDestroyer.new(Discourse.system_user, second_post, agree_flags: true).destroy
|
||||
expect(Jobs::SendSystemMessage.jobs.size).to eq(0)
|
||||
expect(PostAction.flagged_posts_count).to eq(0)
|
||||
second_post.expects(:update_flagged_posts_count)
|
||||
PostDestroyer.new(Discourse.system_user, second_post).destroy
|
||||
expect(
|
||||
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 it was deleted by author" do
|
||||
SiteSetting.delete_removed_posts_after = 0
|
||||
expect(PostAction.flagged_posts_count).to eq(1)
|
||||
PostDestroyer.new(second_post.user, second_post, agree_flags: true).destroy
|
||||
expect(Jobs::SendSystemMessage.jobs.size).to eq(0)
|
||||
expect(PostAction.flagged_posts_count).to eq(0)
|
||||
second_post.expects(:update_flagged_posts_count)
|
||||
PostDestroyer.new(second_post.user, second_post).destroy
|
||||
expect(
|
||||
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
|
||||
expect(PostAction.flagged_posts_count).to eq(1)
|
||||
second_post.expects(:update_flagged_posts_count)
|
||||
PostAction.defer_flags!(second_post, moderator)
|
||||
second_post.reload
|
||||
expect(PostAction.flagged_posts_count).to eq(0)
|
||||
|
||||
PostDestroyer.new(moderator, second_post, agree_flags: true).destroy
|
||||
expect(Jobs::SendSystemMessage.jobs.size).to eq(0)
|
||||
end
|
||||
|
||||
it "should not send the flags_agreed_and_post_deleted message if agree_flags is false" do
|
||||
expect(PostAction.flagged_posts_count).to eq(1)
|
||||
PostDestroyer.new(moderator, second_post, agree_flags: false).destroy
|
||||
expect(Jobs::SendSystemMessage.jobs.size).to eq(0)
|
||||
expect(PostAction.flagged_posts_count).to eq(0)
|
||||
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
|
||||
|
||||
it "should set the deleted_public_actions custom field" do
|
||||
|
||||
Reference in New Issue
Block a user