FIX: Do not cook post if Post#raw has not been changed.

This commit is contained in:
Guo Xiang Tan
2016-10-24 12:02:38 +08:00
parent ee9946388c
commit efea296c7a
2 changed files with 20 additions and 1 deletions

View File

@@ -522,7 +522,11 @@ class Post < ActiveRecord::Base
before_save do
self.last_editor_id ||= user_id
self.cooked = cook(raw, topic_id: topic_id) unless new_record?
if !new_record? && raw_changed?
self.cooked = cook(raw, topic_id: topic_id)
end
self.baked_at = Time.new
self.baked_version = BAKED_VERSION
end