mirror of
https://github.com/discourse/discourse.git
synced 2026-09-05 04:40:41 -05:00
FIX: move draft cleanup to the dedicated method and add test
This commit is contained in:
@@ -41,6 +41,10 @@ class Draft < ActiveRecord::Base
|
||||
WHERE s.draft_key = drafts.draft_key AND
|
||||
s.user_id = drafts.user_id
|
||||
)")
|
||||
|
||||
# remove old drafts
|
||||
delete_drafts_older_than_n_days = SiteSetting.delete_drafts_older_than_n_days.days.ago
|
||||
Draft.where("updated_at < ?", delete_drafts_older_than_n_days).destroy_all
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user