Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
ca89b6e3
Commit
ca89b6e3
authored
Nov 16, 2016
by
Herbert Kagumba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the slack notification comment link.
parent
0f43c307
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
14 deletions
+18
-14
app/models/project_services/slack_service/note_message.rb
app/models/project_services/slack_service/note_message.rb
+6
-6
changelogs/unreleased/24107-slack-comment-link.yml
changelogs/unreleased/24107-slack-comment-link.yml
+4
-0
spec/models/project_services/slack_service/note_message_spec.rb
...odels/project_services/slack_service/note_message_spec.rb
+8
-8
No files found.
app/models/project_services/slack_service/note_message.rb
View file @
ca89b6e3
...
...
@@ -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
changelogs/unreleased/24107-slack-comment-link.yml
0 → 100644
View file @
ca89b6e3
---
title
:
Change slack notification comment link
merge_request
:
7498
author
:
Herbert Kagumba
spec/models/project_services/slack_service/note_message_spec.rb
View file @
ca89b6e3
...
...
@@ -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
=
[
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment