Link to the tag in system note

This commit is contained in:
Peter Leitzen 2018-07-23 22:16:00 +02:00
parent 7405a7ae5f
commit 394107f5f6
2 changed files with 6 additions and 3 deletions

View File

@ -41,7 +41,8 @@ module SystemNoteService
#
# Returns the created Note object
def tag_commit(noteable, project, author, tag_name)
body = "tagged commit #{noteable.sha} to `#{tag_name}`"
link = url_helpers.project_tag_url(project, id: tag_name)
body = "tagged commit #{noteable.sha} to [`#{tag_name}`](#{link})"
create_note(NoteSummary.new(noteable, project, author, body, action: 'tag'))
end

View File

@ -112,7 +112,7 @@ describe SystemNoteService do
let(:noteable) do
project.commit
end
let(:tag_name) { '1.2.3' }
let(:tag_name) { 'v1.2.3' }
subject { described_class.tag_commit(noteable, project, author, tag_name) }
@ -121,7 +121,9 @@ describe SystemNoteService do
end
it 'sets the note text' do
expect(subject.note).to eq "tagged commit #{noteable.sha} to `#{tag_name}`"
link = "http://localhost/#{project.full_path}/tags/#{tag_name}"
expect(subject.note).to eq "tagged commit #{noteable.sha} to [`#{tag_name}`](#{link})"
end
end