Files
danbooru/app/logical/post_pruner.rb
evazion 157cb96551 posts: clean up delete! method.
* Remove unused `ban` and `without_mod_action` options.

* Don't try to set the `is_banned` flag during deletion.

* Don't create modactions for automatic "unapproved in 3 days"
  deletions, only to delete them after the fact.
2020-08-03 20:21:28 -05:00

21 lines
442 B
Ruby

class PostPruner
def prune!
prune_pending!
prune_flagged!
end
def prune_pending!
Post.pending.expired.each do |post|
post.delete!("Unapproved in three days", user: User.system)
end
end
def prune_flagged!
Post.flagged.each do |post|
if post.flags.unresolved.old.any?
post.delete!("Unapproved in three days after returning to moderation queue", user: User.system)
end
end
end
end