mirror of
https://github.com/discourse/discourse.git
synced 2026-08-04 10:23:17 -05:00
The "Remove upload markup from deleted posts" automation was incorrectly processing posts that were deleted but still had pending reviewables in the review queue. Scenario: When a post is flagged (hidden from public) and the author subsequently deletes it, the post has both `hidden: true` and `deleted_at` set. The automation would strip upload markup from these posts, causing data loss when moderators later restored them after completing their review. This fix adds a NOT EXISTS clause to exclude any post with a pending reviewable targeting it. The automation will now wait until the review is resolved (approved/rejected/ignored) before processing the post.