@@ -75,7 +75,7 class Issue < ActiveRecord::Base | |||
|
75 | 75 | :conditions => ["#{Project.table_name}.status=#{Project::STATUS_ACTIVE}"] |
|
76 | 76 | |
|
77 | 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 | 79 | after_save {|issue| issue.send :after_project_change if !issue.id_changed? && issue.project_id_changed?} |
|
80 | 80 | after_save :reschedule_following_issues, :update_nested_set_attributes, :update_parent_attributes, :create_journal |
|
81 | 81 | after_destroy :update_parent_attributes |
@@ -432,8 +432,6 class Issue < ActiveRecord::Base | |||
|
432 | 432 | @custom_values_before_change = {} |
|
433 | 433 | self.custom_field_values.each {|c| @custom_values_before_change.store c.custom_field_id, c.value } |
|
434 | 434 | end |
|
435 | # Make sure updated_on is updated when adding a note. | |
|
436 | updated_on_will_change! | |
|
437 | 435 | @current_journal |
|
438 | 436 | end |
|
439 | 437 | |
@@ -994,6 +992,13 class Issue < ActiveRecord::Base | |||
|
994 | 992 | end |
|
995 | 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 | 1002 | # Saves the changes in a Journal |
|
998 | 1003 | # Called after_save |
|
999 | 1004 | def create_journal |
@@ -445,6 +445,19 class IssueTest < ActiveSupport::TestCase | |||
|
445 | 445 | issue.save! |
|
446 | 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 | 461 | def test_should_close_duplicates |
|
449 | 462 | # Create 3 issues |
|
450 | 463 | project = Project.find(1) |
General Comments 0
You need to be logged in to leave comments.
Login now