##// END OF EJS Templates
Fixed that updated_on is not updated when updating an issue (#10964)....
Jean-Philippe Lang -
r9520:6206c88dfabf
parent child
Show More
@@ -75,7 +75,7 class Issue < ActiveRecord::Base
75 :conditions => ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE}"]
75 :conditions => ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE}"]
76
76
77 before_create :default_assign
77 before_create :default_assign
78 before_save :close_duplicates, :update_done_ratio_from_issue_status
78 before_save :close_duplicates, :update_done_ratio_from_issue_status, :force_updated_on_change
79 after_save {|issue| issue.send :after_project_change if !issue.id_changed? && issue.project_id_changed?}
79 after_save {|issue| issue.send :after_project_change if !issue.id_changed? && issue.project_id_changed?}
80 after_save :reschedule_following_issues, :update_nested_set_attributes, :update_parent_attributes, :create_journal
80 after_save :reschedule_following_issues, :update_nested_set_attributes, :update_parent_attributes, :create_journal
81 after_destroy :update_parent_attributes
81 after_destroy :update_parent_attributes
@@ -432,8 +432,6 class Issue < ActiveRecord::Base
432 @custom_values_before_change = {}
432 @custom_values_before_change = {}
433 self.custom_field_values.each {|c| @custom_values_before_change.store c.custom_field_id, c.value }
433 self.custom_field_values.each {|c| @custom_values_before_change.store c.custom_field_id, c.value }
434 end
434 end
435 # Make sure updated_on is updated when adding a note.
436 updated_on_will_change!
437 @current_journal
435 @current_journal
438 end
436 end
439
437
@@ -994,6 +992,13 class Issue < ActiveRecord::Base
994 end
992 end
995 end
993 end
996
994
995 # Make sure updated_on is updated when adding a note
996 def force_updated_on_change
997 if @current_journal
998 self.updated_on = current_time_from_proper_timezone
999 end
1000 end
1001
997 # Saves the changes in a Journal
1002 # Saves the changes in a Journal
998 # Called after_save
1003 # Called after_save
999 def create_journal
1004 def create_journal
@@ -445,6 +445,19 class IssueTest < ActiveSupport::TestCase
445 issue.save!
445 issue.save!
446 end
446 end
447
447
448 def test_adding_journal_should_update_timestamp
449 issue = Issue.find(1)
450 updated_on_was = issue.updated_on
451
452 issue.init_journal(User.first, "Adding notes")
453 assert_difference 'Journal.count' do
454 assert issue.save
455 end
456 issue.reload
457
458 assert_not_equal updated_on_was, issue.updated_on
459 end
460
448 def test_should_close_duplicates
461 def test_should_close_duplicates
449 # Create 3 issues
462 # Create 3 issues
450 project = Project.find(1)
463 project = Project.find(1)
General Comments 0
You need to be logged in to leave comments. Login now