diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-05-21 18:23:03 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-05-21 18:23:03 +0000 |
commit | 6206c88dfabf4b320ab35026c2833dbb4e9a593c (patch) | |
tree | a715213ff69ef6628018a05b45faef8dc828701f | |
parent | 1ab9e42b9be7c46c97ad77fa275c919928d183b8 (diff) | |
download | redmine-6206c88dfabf4b320ab35026c2833dbb4e9a593c.tar.gz redmine-6206c88dfabf4b320ab35026c2833dbb4e9a593c.zip |
Fixed that updated_on is not updated when updating an issue (#10964).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9703 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/issue.rb | 11 | ||||
-rw-r--r-- | test/unit/issue_test.rb | 13 |
2 files changed, 21 insertions, 3 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index cff39dc42..118b8acf1 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -75,7 +75,7 @@ class Issue < ActiveRecord::Base :conditions => ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE}"] before_create :default_assign - before_save :close_duplicates, :update_done_ratio_from_issue_status + before_save :close_duplicates, :update_done_ratio_from_issue_status, :force_updated_on_change after_save {|issue| issue.send :after_project_change if !issue.id_changed? && issue.project_id_changed?} after_save :reschedule_following_issues, :update_nested_set_attributes, :update_parent_attributes, :create_journal after_destroy :update_parent_attributes @@ -432,8 +432,6 @@ class Issue < ActiveRecord::Base @custom_values_before_change = {} self.custom_field_values.each {|c| @custom_values_before_change.store c.custom_field_id, c.value } end - # Make sure updated_on is updated when adding a note. - updated_on_will_change! @current_journal end @@ -994,6 +992,13 @@ class Issue < ActiveRecord::Base end end + # Make sure updated_on is updated when adding a note + def force_updated_on_change + if @current_journal + self.updated_on = current_time_from_proper_timezone + end + end + # Saves the changes in a Journal # Called after_save def create_journal diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 729e7cc54..1e228cd38 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -445,6 +445,19 @@ class IssueTest < ActiveSupport::TestCase issue.save! end + def test_adding_journal_should_update_timestamp + issue = Issue.find(1) + updated_on_was = issue.updated_on + + issue.init_journal(User.first, "Adding notes") + assert_difference 'Journal.count' do + assert issue.save + end + issue.reload + + assert_not_equal updated_on_was, issue.updated_on + end + def test_should_close_duplicates # Create 3 issues project = Project.find(1) |