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:
@@ -10,12 +10,14 @@ module PostPruner
|
|||||||
|
|
||||||
def prune_pending!
|
def prune_pending!
|
||||||
Post.pending.expired.each do |post|
|
Post.pending.expired.each do |post|
|
||||||
|
next unless post.is_pending?
|
||||||
post.delete!("Unapproved in three days", user: User.system)
|
post.delete!("Unapproved in three days", user: User.system)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def prune_flagged!
|
def prune_flagged!
|
||||||
PostFlag.expired.each do |flag|
|
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)
|
flag.post.delete!("Unapproved in three days after returning to moderation queue", user: User.system)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user