discourse/app/jobs/scheduled/clean_up_drafts.rb

13 lines
311 B
Ruby
Raw Normal View History

module Jobs
class CleanUpDrafts < Jobs::Scheduled
every 1.week
def execute(args)
delete_drafts_older_than_n_days = SiteSetting.delete_drafts_older_than_n_days.days.ago
# remove old drafts
Draft.where("updated_at < ?", delete_drafts_older_than_n_days).destroy_all
end
end
end