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
Jérome Perrin
gitlab-ce
Commits
80817644
Commit
80817644
authored
Sep 16, 2015
by
Jeroen van Baarsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve issue formatting in Slack service
Signed-off-by:
Jeroen van Baarsen
<
jeroenvanbaarsen@gmail.com
>
parent
636b3ebb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
8 deletions
+25
-8
CHANGELOG
CHANGELOG
+3
-0
app/models/project_services/slack_service/issue_message.rb
app/models/project_services/slack_service/issue_message.rb
+16
-3
spec/models/project_services/slack_service/issue_message_spec.rb
...dels/project_services/slack_service/issue_message_spec.rb
+6
-5
No files found.
CHANGELOG
View file @
80817644
...
...
@@ -894,6 +894,9 @@ v 8.1.3
- Add Facebook authentication
v 8.1.2
- Improve Issue formatting for the Slack Service (Jeroen van Baarsen)
v 8.1.1
- Fix cloning Wiki repositories via HTTP (Stan Hu)
- Add migration to remove satellites directory
- Fix specific runners visibility
...
...
app/models/project_services/slack_service/issue_message.rb
View file @
80817644
...
...
@@ -34,7 +34,12 @@ class SlackService
private
def
message
"
#{
user_name
}
#{
state
}
#{
issue_link
}
in
#{
project_link
}
: *
#{
title
}
*"
case
state
when
"opened"
"[
#{
project_link
}
] Issue
#{
state
}
by
#{
user_name
}
"
else
"[
#{
project_link
}
] Issue
#{
issue_link
}
#{
state
}
by
#{
user_name
}
"
end
end
def
opened_issue?
...
...
@@ -42,7 +47,11 @@ class SlackService
end
def
description_message
[{
text:
format
(
description
),
color:
attachment_color
}]
[{
title:
issue_title
,
title_link:
issue_url
,
text:
format
(
description
),
color:
"#C95823"
}]
end
def
project_link
...
...
@@ -50,7 +59,11 @@ class SlackService
end
def
issue_link
"[issue #
#{
issue_iid
}
](
#{
issue_url
}
)"
"[
#{
issue_title
}
](
#{
issue_url
}
)"
end
def
issue_title
"#
#{
issue_iid
}
#{
title
}
"
end
end
end
spec/models/project_services/slack_service/issue_message_spec.rb
View file @
80817644
...
...
@@ -25,7 +25,7 @@ describe SlackService::IssueMessage, models: true do
}
end
let
(
:color
)
{
'#
345
'
}
let
(
:color
)
{
'#
C95823
'
}
context
'#initialize'
do
before
do
...
...
@@ -40,10 +40,11 @@ describe SlackService::IssueMessage, models: true do
context
'open'
do
it
'returns a message regarding opening of issues'
do
expect
(
subject
.
pretext
).
to
eq
(
'Test User opened <url|issue #100> in <somewhere.com|project_name>: '
\
'*Issue title*'
)
'<somewhere.com|[project_name>] Issue opened by Test User'
)
expect
(
subject
.
attachments
).
to
eq
([
{
title:
"#100 Issue title"
,
title_link:
"url"
,
text:
"issue description"
,
color:
color
,
}
...
...
@@ -56,10 +57,10 @@ describe SlackService::IssueMessage, models: true do
args
[
:object_attributes
][
:action
]
=
'close'
args
[
:object_attributes
][
:state
]
=
'closed'
end
it
'returns a message regarding closing of issues'
do
expect
(
subject
.
pretext
).
to
eq
(
'Test User closed <url|issue #100> in <somewhere.com|project_name>: '
\
'*Issue title*'
)
'<somewhere.com|[project_name>] Issue <url|#100 Issue title> closed by Test User'
)
expect
(
subject
.
attachments
).
to
be_empty
end
end
...
...
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