mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FEATURE: auto-delete any hidden posts that stay hidden for more than 30 days
This commit is contained in:
parent
b16e6f8289
commit
69400a802f
6 changed files with 64 additions and 3 deletions
|
@ -4,6 +4,14 @@
|
|||
#
|
||||
class PostDestroyer
|
||||
|
||||
def self.destroy_old_hidden_posts
|
||||
Post.where(deleted_at: nil)
|
||||
.where("hidden_at < ?", 30.days.ago)
|
||||
.find_each do |post|
|
||||
PostDestroyer.new(Discourse.system_user, post).destroy
|
||||
end
|
||||
end
|
||||
|
||||
def self.destroy_stubs
|
||||
# exclude deleted topics and posts that are actively flagged
|
||||
Post.where(deleted_at: nil, user_deleted: true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue