mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-28 01:56:01 -05:00
BUGFIX: revision history was messed up when doing quick edits
This commit is contained in:
parent
dc0a758ec6
commit
02dd80170a
1 changed files with 8 additions and 1 deletions
|
@ -498,7 +498,14 @@ class Post < ActiveRecord::Base
|
||||||
revision = PostRevision.where(post_id: id, number: version).first
|
revision = PostRevision.where(post_id: id, number: version).first
|
||||||
return unless revision
|
return unless revision
|
||||||
revision.user_id = last_editor_id
|
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
|
revision.save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue