FIX: Don't send replies to flags that are ignored by expiry
The `AutoQueueHandler` will ignore really old flags. In that case, don't notify the user that the moderator is looking into it. They probably never saw it because it didn't meet the reviewable minimum priority.
This commit is contained in:
parent
9568f25882
commit
b85fa62882
|
@ -16,7 +16,7 @@ module Jobs
|
|||
.each do |reviewable|
|
||||
|
||||
if reviewable.is_a?(ReviewableFlaggedPost)
|
||||
reviewable.perform(Discourse.system_user, :ignore)
|
||||
reviewable.perform(Discourse.system_user, :ignore, expired: true)
|
||||
elsif reviewable.is_a?(ReviewableQueuedPost)
|
||||
reviewable.perform(Discourse.system_user, :reject_post)
|
||||
elsif reviewable.is_a?(ReviewableUser)
|
||||
|
|
|
@ -101,7 +101,9 @@ class ReviewableFlaggedPost < Reviewable
|
|||
action.deferred_by_id = performed_by.id
|
||||
# so callback is called
|
||||
action.save
|
||||
action.add_moderator_post_if_needed(performed_by, :ignored, args[:post_was_deleted])
|
||||
unless args[:expired]
|
||||
action.add_moderator_post_if_needed(performed_by, :ignored, args[:post_was_deleted])
|
||||
end
|
||||
end
|
||||
|
||||
if actions.first.present?
|
||||
|
|
|
@ -6,8 +6,24 @@ describe Jobs::AutoQueueHandler do
|
|||
|
||||
subject { Jobs::AutoQueueHandler.new.execute({}) }
|
||||
|
||||
context "old flag" do
|
||||
fab!(:old) { Fabricate(:reviewable_flagged_post, created_at: 61.days.ago) }
|
||||
context "old flagged post" do
|
||||
# fab!(:old) { Fabricate(:reviewable_flagged_post, created_at: 61.days.ago) }
|
||||
|
||||
fab!(:spam_result) do
|
||||
PostActionCreator.new(
|
||||
Fabricate(:user),
|
||||
Fabricate(:post),
|
||||
PostActionType.types[:spam],
|
||||
message: 'this is the initial message'
|
||||
).perform
|
||||
end
|
||||
|
||||
fab!(:post_action) { spam_result.post_action }
|
||||
fab!(:old) {
|
||||
spam_result.reviewable.update_column(:created_at, 61.days.ago)
|
||||
spam_result.reviewable
|
||||
}
|
||||
|
||||
fab!(:not_old) { Fabricate(:reviewable_flagged_post, created_at: 59.days.ago) }
|
||||
|
||||
it "defers the old flag if auto_handle_queued_age is 60" do
|
||||
|
@ -15,6 +31,7 @@ describe Jobs::AutoQueueHandler do
|
|||
subject
|
||||
expect(not_old.reload).to be_pending
|
||||
expect(old.reload).not_to be_pending
|
||||
expect(post_action.related_post.topic.posts_count).to eq(1)
|
||||
end
|
||||
|
||||
it "doesn't defer the old flag if auto_handle_queued_age is 0" do
|
||||
|
|
Loading…
Reference in New Issue