Commit ca89b6e3 authored by Herbert Kagumba's avatar Herbert Kagumba

Change the slack notification comment link.

parent 0f43c307
......@@ -46,25 +46,25 @@ class SlackService
commit_sha = commit[:id]
commit_sha = Commit.truncate_sha(commit_sha)
commented_on_message(
"[commit #{commit_sha}](#{@note_url})",
"commit #{commit_sha}",
format_title(commit[:message]))
end
def create_issue_note(issue)
commented_on_message(
"[issue ##{issue[:iid]}](#{@note_url})",
"issue ##{issue[:iid]}",
format_title(issue[:title]))
end
def create_merge_note(merge_request)
commented_on_message(
"[merge request !#{merge_request[:iid]}](#{@note_url})",
"merge request !#{merge_request[:iid]}",
format_title(merge_request[:title]))
end
def create_snippet_note(snippet)
commented_on_message(
"[snippet ##{snippet[:id]}](#{@note_url})",
"snippet ##{snippet[:id]}",
format_title(snippet[:title]))
end
......@@ -76,8 +76,8 @@ class SlackService
"[#{@project_name}](#{@project_url})"
end
def commented_on_message(target_link, title)
@message = "#{@user_name} commented on #{target_link} in #{project_link}: *#{title}*"
def commented_on_message(target, title)
@message = "#{@user_name} [commented on #{target}](#{@note_url}) in #{project_link}: *#{title}*"
end
end
end
---
title: Change slack notification comment link
merge_request: 7498
author: Herbert Kagumba
......@@ -37,8 +37,8 @@ describe SlackService::NoteMessage, models: true do
it 'returns a message regarding notes on commits' do
message = SlackService::NoteMessage.new(@args)
expect(message.pretext).to eq("test.user commented on " \
"<url|commit 5f163b2b> in <somewhere.com|project_name>: " \
expect(message.pretext).to eq("test.user <url|commented on " \
"commit 5f163b2b> in <somewhere.com|project_name>: " \
"*Added a commit message*")
expected_attachments = [
{
......@@ -63,8 +63,8 @@ describe SlackService::NoteMessage, models: true do
it 'returns a message regarding notes on a merge request' do
message = SlackService::NoteMessage.new(@args)
expect(message.pretext).to eq("test.user commented on " \
"<url|merge request !30> in <somewhere.com|project_name>: " \
expect(message.pretext).to eq("test.user <url|commented on " \
"merge request !30> in <somewhere.com|project_name>: " \
"*merge request title*")
expected_attachments = [
{
......@@ -90,8 +90,8 @@ describe SlackService::NoteMessage, models: true do
it 'returns a message regarding notes on an issue' do
message = SlackService::NoteMessage.new(@args)
expect(message.pretext).to eq(
"test.user commented on " \
"<url|issue #20> in <somewhere.com|project_name>: " \
"test.user <url|commented on " \
"issue #20> in <somewhere.com|project_name>: " \
"*issue title*")
expected_attachments = [
{
......@@ -115,8 +115,8 @@ describe SlackService::NoteMessage, models: true do
it 'returns a message regarding notes on a project snippet' do
message = SlackService::NoteMessage.new(@args)
expect(message.pretext).to eq("test.user commented on " \
"<url|snippet #5> in <somewhere.com|project_name>: " \
expect(message.pretext).to eq("test.user <url|commented on " \
"snippet #5> in <somewhere.com|project_name>: " \
"*snippet title*")
expected_attachments = [
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment