FIX: nil the baked version after moving the posts. (#14483)

Previosuly, quotes from original topics are rendered incorrectly since the moved posts are not rebaked.

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
This commit is contained in:
Vinoth Kannan
2021-10-12 12:01:18 +05:30
committed by GitHub
parent fd9a5bc023
commit eeecb2460d
3 changed files with 8 additions and 7 deletions

View File

@ -732,12 +732,11 @@ class Post < ActiveRecord::Base
before_save do
self.last_editor_id ||= user_id
if !new_record? && will_save_change_to_raw?
self.cooked = cook(raw, topic_id: topic_id)
if will_save_change_to_raw?
self.cooked = cook(raw, topic_id: topic_id) if !new_record?
self.baked_at = Time.zone.now
self.baked_version = BAKED_VERSION
end
self.baked_at = Time.zone.now
self.baked_version = BAKED_VERSION
end
def advance_draft_sequence