Fix #3243: Don't create new note versions when nothing is changed.

This commit is contained in:
evazion
2017-07-28 17:41:05 -05:00
parent 76b4b365ae
commit 4b635628cc
2 changed files with 13 additions and 0 deletions

View File

@@ -146,6 +146,7 @@ class Note < ApplicationRecord
end
def create_version
return unless versioned_attributes_changed?
User.where(id: CurrentUser.id).update_all("note_update_count = note_update_count + 1")
CurrentUser.reload
@@ -158,6 +159,10 @@ class Note < ApplicationRecord
end
end
def versioned_attributes_changed?
new_record? || x_changed? || y_changed? || width_changed? || height_changed? || is_active_changed? || body_changed?
end
def create_new_version
versions.create(
:updater_id => updater_id,