Fixed magic link in the note added when closing an issue by a commit from a subproject (#10284).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8917 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
5b48e4ae58
commit
77287d1f0b
|
@ -151,12 +151,16 @@ class Changeset < ActiveRecord::Base
|
||||||
@long_comments || split_comments.last
|
@long_comments || split_comments.last
|
||||||
end
|
end
|
||||||
|
|
||||||
def text_tag
|
def text_tag(ref_project=nil)
|
||||||
if scmid?
|
tag = if scmid?
|
||||||
"commit:#{scmid}"
|
"commit:#{scmid}"
|
||||||
else
|
else
|
||||||
"r#{revision}"
|
"r#{revision}"
|
||||||
end
|
end
|
||||||
|
if ref_project && project && ref_project != project
|
||||||
|
tag = "#{project.identifier}:#{tag}"
|
||||||
|
end
|
||||||
|
tag
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the previous changeset
|
# Returns the previous changeset
|
||||||
|
@ -215,7 +219,7 @@ class Changeset < ActiveRecord::Base
|
||||||
# don't change the status is the issue is closed
|
# don't change the status is the issue is closed
|
||||||
return if issue.status && issue.status.is_closed?
|
return if issue.status && issue.status.is_closed?
|
||||||
|
|
||||||
journal = issue.init_journal(user || User.anonymous, ll(Setting.default_language, :text_status_changed_by_changeset, text_tag))
|
journal = issue.init_journal(user || User.anonymous, ll(Setting.default_language, :text_status_changed_by_changeset, text_tag(issue.project)))
|
||||||
issue.status = status
|
issue.status = status
|
||||||
unless Setting.commit_fix_done_ratio.blank?
|
unless Setting.commit_fix_done_ratio.blank?
|
||||||
issue.done_ratio = Setting.commit_fix_done_ratio.to_i
|
issue.done_ratio = Setting.commit_fix_done_ratio.to_i
|
||||||
|
@ -234,7 +238,7 @@ class Changeset < ActiveRecord::Base
|
||||||
:hours => hours,
|
:hours => hours,
|
||||||
:issue => issue,
|
:issue => issue,
|
||||||
:spent_on => commit_date,
|
:spent_on => commit_date,
|
||||||
:comments => l(:text_time_logged_by_changeset, :value => text_tag,
|
:comments => l(:text_time_logged_by_changeset, :value => text_tag(issue.project),
|
||||||
:locale => Setting.default_language)
|
:locale => Setting.default_language)
|
||||||
)
|
)
|
||||||
time_entry.activity = log_time_activity unless log_time_activity.nil?
|
time_entry.activity = log_time_activity unless log_time_activity.nil?
|
||||||
|
|
|
@ -178,6 +178,24 @@ class ChangesetTest < ActiveSupport::TestCase
|
||||||
assert c.issues.first.project != c.project
|
assert c.issues.first.project != c.project
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_commit_closing_a_subproject_issue
|
||||||
|
with_settings :commit_fix_status_id => 5, :commit_fix_keywords => 'closes' do
|
||||||
|
issue = Issue.find(5)
|
||||||
|
assert !issue.closed?
|
||||||
|
assert_difference 'Journal.count' do
|
||||||
|
c = Changeset.new(:repository => Project.find(1).repository,
|
||||||
|
:committed_on => Time.now,
|
||||||
|
:comments => 'closes #5, a subproject issue',
|
||||||
|
:revision => '12345')
|
||||||
|
assert c.save
|
||||||
|
end
|
||||||
|
assert issue.reload.closed?
|
||||||
|
journal = Journal.first(:order => 'id DESC')
|
||||||
|
assert_equal issue, journal.issue
|
||||||
|
assert_include "Applied in changeset ecookbook:r12345.", journal.notes
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_commit_referencing_a_parent_project_issue
|
def test_commit_referencing_a_parent_project_issue
|
||||||
# repository of child project
|
# repository of child project
|
||||||
r = Repository::Subversion.create!(
|
r = Repository::Subversion.create!(
|
||||||
|
@ -227,6 +245,16 @@ class ChangesetTest < ActiveSupport::TestCase
|
||||||
assert_equal 'r520', c.text_tag
|
assert_equal 'r520', c.text_tag
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_text_tag_revision_with_same_project
|
||||||
|
c = Changeset.new(:revision => '520', :repository => Project.find(1).repository)
|
||||||
|
assert_equal 'r520', c.text_tag(Project.find(1))
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_text_tag_revision_with_different_project
|
||||||
|
c = Changeset.new(:revision => '520', :repository => Project.find(1).repository)
|
||||||
|
assert_equal 'ecookbook:r520', c.text_tag(Project.find(2))
|
||||||
|
end
|
||||||
|
|
||||||
def test_text_tag_hash
|
def test_text_tag_hash
|
||||||
c = Changeset.new(
|
c = Changeset.new(
|
||||||
:scmid => '7234cb2750b63f47bff735edc50a1c0a433c2518',
|
:scmid => '7234cb2750b63f47bff735edc50a1c0a433c2518',
|
||||||
|
@ -234,6 +262,16 @@ class ChangesetTest < ActiveSupport::TestCase
|
||||||
assert_equal 'commit:7234cb2750b63f47bff735edc50a1c0a433c2518', c.text_tag
|
assert_equal 'commit:7234cb2750b63f47bff735edc50a1c0a433c2518', c.text_tag
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_text_tag_hash_with_same_project
|
||||||
|
c = Changeset.new(:revision => '7234cb27', :scmid => '7234cb27', :repository => Project.find(1).repository)
|
||||||
|
assert_equal 'commit:7234cb27', c.text_tag(Project.find(1))
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_text_tag_hash_with_different_project
|
||||||
|
c = Changeset.new(:revision => '7234cb27', :scmid => '7234cb27', :repository => Project.find(1).repository)
|
||||||
|
assert_equal 'ecookbook:commit:7234cb27', c.text_tag(Project.find(2))
|
||||||
|
end
|
||||||
|
|
||||||
def test_text_tag_hash_all_number
|
def test_text_tag_hash_all_number
|
||||||
c = Changeset.new(:scmid => '0123456789', :revision => '0123456789')
|
c = Changeset.new(:scmid => '0123456789', :revision => '0123456789')
|
||||||
assert_equal 'commit:0123456789', c.text_tag
|
assert_equal 'commit:0123456789', c.text_tag
|
||||||
|
|
Loading…
Reference in New Issue