mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: leaving around useless drafts after posting
This commit is contained in:
@@ -34,6 +34,15 @@ class Draft < ActiveRecord::Base
|
||||
find_by(user_id: user, draft_key: key)
|
||||
end
|
||||
end
|
||||
|
||||
def self.cleanup!
|
||||
exec_sql("DELETE FROM drafts where sequence < (
|
||||
SELECT max(s.sequence) from draft_sequences s
|
||||
WHERE s.draft_key = drafts.draft_key AND
|
||||
s.user_id = drafts.user_id
|
||||
)")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
|
||||
Reference in New Issue
Block a user