From: Jean-Philippe Lang Date: Sat, 12 Mar 2016 10:10:04 +0000 (+0000) Subject: Backported r15196 to 2.6-stable (#22072). X-Git-Tag: 2.6.10~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=773f44d95e08b9679367eff85b5062dfcf075a4c;p=redmine.git Backported r15196 to 2.6-stable (#22072). git-svn-id: http://svn.redmine.org/redmine/branches/2.6-stable@15209 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/issue.rb b/app/models/issue.rb index 0d52c8f0e..d8f2cadcf 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -1484,6 +1484,7 @@ class Issue < ActiveRecord::Base # Same user and notes if @current_journal duplicate.init_journal(@current_journal.user, @current_journal.notes) + duplicate.private_notes = @current_journal.private_notes end duplicate.update_attribute :status, self.status end diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index a5804af72..10a003b56 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -1120,6 +1120,25 @@ class IssueTest < ActiveSupport::TestCase assert issue3.reload.closed? end + def test_should_close_duplicates_with_private_notes + issue = Issue.generate! + duplicate = Issue.generate! + IssueRelation.create!(:issue_from => duplicate, :issue_to => issue, + :relation_type => IssueRelation::TYPE_DUPLICATES) + assert issue.reload.duplicates.include?(duplicate) + + # Closing issue with private notes + issue = Issue.find(issue.id) + issue.init_journal(User.first, "Private notes") + issue.private_notes = true + issue.status = IssueStatus.where(:is_closed => true).first + assert_save issue + + duplicate.reload + assert journal = duplicate.journals.detect {|journal| journal.notes == "Private notes"} + assert_equal true, journal.private_notes + end + def test_should_not_close_duplicated_issue issue1 = Issue.generate! issue2 = Issue.generate!