FIX: Update draft count after creating a post (#13884)

When a post is created, the draft sequence is increased and then older
drafts are automatically executing a raw SQL query. This skipped the
Draft model callbacks and did not update user's draft count.

I fixed another problem related to a raw SQL query from Draft.cleanup!
method.
This commit is contained in:
Bianca Nenciu
2021-07-29 17:06:11 +03:00
committed by GitHub
parent 9b8c4d4790
commit 300db3d3fa
5 changed files with 36 additions and 14 deletions
+1
View File
@@ -229,6 +229,7 @@ class PostCreator
@post.topic.reload
publish
UserStat.update_draft_count(@user.id)
track_latest_on_category
enqueue_jobs unless @opts[:skip_jobs]