FIX: user-deleted posts with deferred flags can be destroyed
This commit is contained in:
parent
04658bb2f1
commit
d77dccc636
|
@ -26,9 +26,10 @@ class PostDestroyer
|
||||||
.where("NOT EXISTS (
|
.where("NOT EXISTS (
|
||||||
SELECT 1
|
SELECT 1
|
||||||
FROM post_actions pa
|
FROM post_actions pa
|
||||||
WHERE pa.post_id = posts.id AND
|
WHERE pa.post_id = posts.id
|
||||||
pa.deleted_at IS NULL AND
|
AND pa.deleted_at IS NULL
|
||||||
pa.post_action_type_id IN (?)
|
AND pa.deferred_at IS NULL
|
||||||
|
AND pa.post_action_type_id IN (?)
|
||||||
)", PostActionType.notify_flag_type_ids)
|
)", PostActionType.notify_flag_type_ids)
|
||||||
.find_each do |post|
|
.find_each do |post|
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,12 @@ describe PostDestroyer do
|
||||||
reply1.reload
|
reply1.reload
|
||||||
expect(reply1.deleted_at).to eq(nil)
|
expect(reply1.deleted_at).to eq(nil)
|
||||||
|
|
||||||
|
# defer the flag, we should be able to delete the stub
|
||||||
|
PostAction.defer_flags!(reply1, Discourse.system_user)
|
||||||
|
PostDestroyer.destroy_stubs
|
||||||
|
|
||||||
|
reply1.reload
|
||||||
|
expect(reply1.deleted_at).to_not eq(nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'uses the delete_removed_posts_after site setting' do
|
it 'uses the delete_removed_posts_after site setting' do
|
||||||
|
|
Loading…
Reference in New Issue