mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
FIX: Destroy Drafts when increasing sequences (#27739)
Drafts used to be deleted instead of being destroyed. The callbacks that clean up the upload references were not being called. As a result, the upload references were not cleaned up and uploads were not deleted either. This has been partially fixed in 9655bf3e.
This commit is contained in:
@ -20,12 +20,7 @@ class DraftSequence < ActiveRecord::Base
|
||||
RETURNING sequence
|
||||
SQL
|
||||
|
||||
DB.exec(
|
||||
"DELETE FROM drafts WHERE user_id = :user_id AND draft_key = :draft_key AND sequence < :sequence",
|
||||
draft_key: key,
|
||||
user_id: user_id,
|
||||
sequence: sequence,
|
||||
)
|
||||
Draft.where(user_id: user_id).where(draft_key: key).where("sequence < ?", sequence).destroy_all
|
||||
|
||||
UserStat.update_draft_count(user_id)
|
||||
|
||||
|
Reference in New Issue
Block a user