mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 19:30:23 -06:00
BUGFIX: revision history was messed up when doing quick edits
This commit is contained in:
parent
dc0a758ec6
commit
02dd80170a
@ -498,7 +498,14 @@ class Post < ActiveRecord::Base
|
||||
revision = PostRevision.where(post_id: id, number: version).first
|
||||
return unless revision
|
||||
revision.user_id = last_editor_id
|
||||
revision.modifications = changes.extract!(:raw, :cooked, :edit_reason)
|
||||
modifications = changes.extract!(:raw, :cooked, :edit_reason)
|
||||
[:raw, :cooked, :edit_reason].each do |field|
|
||||
if modifications[field].present?
|
||||
old_value = revision.modifications[field].try(:[], 0) || ""
|
||||
new_value = modifications[field][1]
|
||||
revision.modifications[field] = [old_value, new_value]
|
||||
end
|
||||
end
|
||||
revision.save
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user