posts: add workaround to avoid falsely delete pending posts.

Add a temporary workaround for the database index corruption bug. Add a
check to skip deleting pending posts if they're not really pending.
This commit is contained in:
evazion
2021-10-08 21:44:47 -05:00
parent c4eeeb8531
commit 8b0d58130c

View File

@@ -10,12 +10,14 @@ module PostPruner
def prune_pending!
Post.pending.expired.each do |post|
next unless post.is_pending?
post.delete!("Unapproved in three days", user: User.system)
end
end
def prune_flagged!
PostFlag.expired.each do |flag|
next unless flag.post.is_flagged?
flag.post.delete!("Unapproved in three days after returning to moderation queue", user: User.system)
end
end