Defect #33610 » fix-33610.patch
| app/models/issue.rb | ||
|---|---|---|
|
# Make sure updated_on is updated when adding a note and set updated_on now
|
||
|
# so we can set closed_on with the same value on closing
|
||
|
def force_updated_on_change
|
||
|
if @current_journal || changed?
|
||
|
if changed? || (@current_journal && !@current_journal.notes_and_details_empty?)
|
||
|
self.updated_on = current_time_from_proper_timezone
|
||
|
if new_record?
|
||
|
self.created_on = updated_on
|
||
| app/models/journal.rb | ||
|---|---|---|
|
def save(*args)
|
||
|
journalize_changes
|
||
|
# Do not save an empty journal
|
||
|
(details.empty? && notes.blank?) ? false : super
|
||
|
notes_and_details_empty? ? false : super
|
||
|
end
|
||
|
def notes_and_details_empty?
|
||
|
notes.blank? && details.empty?
|
||
|
end
|
||
|
# Returns journal details that are visible to user
|
||
| test/unit/issue_test.rb | ||
|---|---|---|
|
assert_not_equal updated_on_was, issue.updated_on
|
||
|
end
|
||
|
def test_adding_journal_with_notes_and_details_empty_should_not_update_timestamp
|
||
|
issue = Issue.find(1)
|
||
|
updated_on_was = issue.updated_on
|
||
|
issue.init_journal(User.first)
|
||
|
assert_no_difference 'Journal.count' do
|
||
|
assert issue.save
|
||
|
end
|
||
|
issue.reload
|
||
|
assert_equal updated_on_was, issue.updated_on
|
||
|
end
|
||
|
def test_should_close_duplicates
|
||
|
# Create 3 issues
|
||
|
issue1 = Issue.generate!
|
||