##// END OF EJS Templates
Dup attributes instead of issue object....
Jean-Philippe Lang -
r8224:8f2304385170
parent child
Show More
@@ -397,8 +397,7 class Issue < ActiveRecord::Base
397
397
398 def init_journal(user, notes = "")
398 def init_journal(user, notes = "")
399 @current_journal ||= Journal.new(:journalized => self, :user => user, :notes => notes)
399 @current_journal ||= Journal.new(:journalized => self, :user => user, :notes => notes)
400 @issue_before_change = self.clone
400 @attributes_before_change = attributes.dup
401 @issue_before_change.status = self.status
402 @custom_values_before_change = {}
401 @custom_values_before_change = {}
403 self.custom_values.each {|c| @custom_values_before_change.store c.custom_field_id, c.value }
402 self.custom_values.each {|c| @custom_values_before_change.store c.custom_field_id, c.value }
404 # Make sure updated_on is updated when adding a note.
403 # Make sure updated_on is updated when adding a note.
@@ -927,13 +926,13 class Issue < ActiveRecord::Base
927 if @current_journal
926 if @current_journal
928 # attributes changes
927 # attributes changes
929 (Issue.column_names - %w(id root_id lft rgt lock_version created_on updated_on)).each {|c|
928 (Issue.column_names - %w(id root_id lft rgt lock_version created_on updated_on)).each {|c|
930 before = @issue_before_change.send(c)
929 before = @attributes_before_change[c]
931 after = send(c)
930 after = send(c)
932 next if before == after || (before.blank? && after.blank?)
931 next if before == after || (before.blank? && after.blank?)
933 @current_journal.details << JournalDetail.new(:property => 'attr',
932 @current_journal.details << JournalDetail.new(:property => 'attr',
934 :prop_key => c,
933 :prop_key => c,
935 :old_value => @issue_before_change.send(c),
934 :old_value => before,
936 :value => send(c))
935 :value => after)
937 }
936 }
938 # custom fields changes
937 # custom fields changes
939 custom_values.each {|c|
938 custom_values.each {|c|
General Comments 0
You need to be logged in to leave comments. Login now