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
0b38e213
Commit
0b38e213
authored
Sep 30, 2016
by
secustor
Committed by
secustor
Oct 03, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed Slack service user referencing from full name to username
parent
9235f1d4
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
25 additions
and
24 deletions
+25
-24
CHANGELOG
CHANGELOG
+1
-0
app/models/project_services/slack_service/issue_message.rb
app/models/project_services/slack_service/issue_message.rb
+1
-1
app/models/project_services/slack_service/merge_message.rb
app/models/project_services/slack_service/merge_message.rb
+1
-1
app/models/project_services/slack_service/note_message.rb
app/models/project_services/slack_service/note_message.rb
+1
-1
app/models/project_services/slack_service/wiki_page_message.rb
...odels/project_services/slack_service/wiki_page_message.rb
+1
-1
spec/models/project_services/slack_service/issue_message_spec.rb
...dels/project_services/slack_service/issue_message_spec.rb
+3
-3
spec/models/project_services/slack_service/merge_message_spec.rb
...dels/project_services/slack_service/merge_message_spec.rb
+3
-3
spec/models/project_services/slack_service/note_message_spec.rb
...odels/project_services/slack_service/note_message_spec.rb
+5
-5
spec/models/project_services/slack_service/push_message_spec.rb
...odels/project_services/slack_service/push_message_spec.rb
+6
-6
spec/models/project_services/slack_service/wiki_page_message_spec.rb
.../project_services/slack_service/wiki_page_message_spec.rb
+3
-3
No files found.
CHANGELOG
View file @
0b38e213
...
@@ -34,6 +34,7 @@ v 8.13.0 (unreleased)
...
@@ -34,6 +34,7 @@ v 8.13.0 (unreleased)
- Notify the Merger about merge after successful build (Dimitris Karakasilis)
- Notify the Merger about merge after successful build (Dimitris Karakasilis)
- Fix broken repository 500 errors in project list
- Fix broken repository 500 errors in project list
- Close todos when accepting merge requests via the API !6486 (tonygambone)
- Close todos when accepting merge requests via the API !6486 (tonygambone)
- Changed Slack service user referencing from full name to username (Sebastian Poxhofer)
v 8.12.4 (unreleased)
v 8.12.4 (unreleased)
...
...
app/models/project_services/slack_service/issue_message.rb
View file @
0b38e213
...
@@ -11,7 +11,7 @@ class SlackService
...
@@ -11,7 +11,7 @@ class SlackService
attr_reader
:description
attr_reader
:description
def
initialize
(
params
)
def
initialize
(
params
)
@user_name
=
params
[
:user
][
:name
]
@user_name
=
params
[
:user
][
:
user
name
]
@project_name
=
params
[
:project_name
]
@project_name
=
params
[
:project_name
]
@project_url
=
params
[
:project_url
]
@project_url
=
params
[
:project_url
]
...
...
app/models/project_services/slack_service/merge_message.rb
View file @
0b38e213
...
@@ -10,7 +10,7 @@ class SlackService
...
@@ -10,7 +10,7 @@ class SlackService
attr_reader
:title
attr_reader
:title
def
initialize
(
params
)
def
initialize
(
params
)
@user_name
=
params
[
:user
][
:name
]
@user_name
=
params
[
:user
][
:
user
name
]
@project_name
=
params
[
:project_name
]
@project_name
=
params
[
:project_name
]
@project_url
=
params
[
:project_url
]
@project_url
=
params
[
:project_url
]
...
...
app/models/project_services/slack_service/note_message.rb
View file @
0b38e213
...
@@ -10,7 +10,7 @@ class SlackService
...
@@ -10,7 +10,7 @@ class SlackService
def
initialize
(
params
)
def
initialize
(
params
)
params
=
HashWithIndifferentAccess
.
new
(
params
)
params
=
HashWithIndifferentAccess
.
new
(
params
)
@user_name
=
params
[
:user
][
:name
]
@user_name
=
params
[
:user
][
:
user
name
]
@project_name
=
params
[
:project_name
]
@project_name
=
params
[
:project_name
]
@project_url
=
params
[
:project_url
]
@project_url
=
params
[
:project_url
]
...
...
app/models/project_services/slack_service/wiki_page_message.rb
View file @
0b38e213
...
@@ -9,7 +9,7 @@ class SlackService
...
@@ -9,7 +9,7 @@ class SlackService
attr_reader
:description
attr_reader
:description
def
initialize
(
params
)
def
initialize
(
params
)
@user_name
=
params
[
:user
][
:name
]
@user_name
=
params
[
:user
][
:
user
name
]
@project_name
=
params
[
:project_name
]
@project_name
=
params
[
:project_name
]
@project_url
=
params
[
:project_url
]
@project_url
=
params
[
:project_url
]
...
...
spec/models/project_services/slack_service/issue_message_spec.rb
View file @
0b38e213
...
@@ -7,7 +7,7 @@ describe SlackService::IssueMessage, models: true do
...
@@ -7,7 +7,7 @@ describe SlackService::IssueMessage, models: true do
{
{
user:
{
user:
{
name:
'Test User'
,
name:
'Test User'
,
username:
'
Test U
ser'
username:
'
test.u
ser'
},
},
project_name:
'project_name'
,
project_name:
'project_name'
,
project_url:
'somewhere.com'
,
project_url:
'somewhere.com'
,
...
@@ -40,7 +40,7 @@ describe SlackService::IssueMessage, models: true do
...
@@ -40,7 +40,7 @@ describe SlackService::IssueMessage, models: true do
context
'open'
do
context
'open'
do
it
'returns a message regarding opening of issues'
do
it
'returns a message regarding opening of issues'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'<somewhere.com|[project_name>] Issue opened by
Test U
ser'
)
'<somewhere.com|[project_name>] Issue opened by
test.u
ser'
)
expect
(
subject
.
attachments
).
to
eq
([
expect
(
subject
.
attachments
).
to
eq
([
{
{
title:
"#100 Issue title"
,
title:
"#100 Issue title"
,
...
@@ -60,7 +60,7 @@ describe SlackService::IssueMessage, models: true do
...
@@ -60,7 +60,7 @@ describe SlackService::IssueMessage, models: true do
it
'returns a message regarding closing of issues'
do
it
'returns a message regarding closing of issues'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'<somewhere.com|[project_name>] Issue <url|#100 Issue title> closed by
Test U
ser'
)
'<somewhere.com|[project_name>] Issue <url|#100 Issue title> closed by
test.u
ser'
)
expect
(
subject
.
attachments
).
to
be_empty
expect
(
subject
.
attachments
).
to
be_empty
end
end
end
end
...
...
spec/models/project_services/slack_service/merge_message_spec.rb
View file @
0b38e213
...
@@ -7,7 +7,7 @@ describe SlackService::MergeMessage, models: true do
...
@@ -7,7 +7,7 @@ describe SlackService::MergeMessage, models: true do
{
{
user:
{
user:
{
name:
'Test User'
,
name:
'Test User'
,
username:
'
Test U
ser'
username:
'
test.u
ser'
},
},
project_name:
'project_name'
,
project_name:
'project_name'
,
project_url:
'somewhere.com'
,
project_url:
'somewhere.com'
,
...
@@ -31,7 +31,7 @@ describe SlackService::MergeMessage, models: true do
...
@@ -31,7 +31,7 @@ describe SlackService::MergeMessage, models: true do
context
'open'
do
context
'open'
do
it
'returns a message regarding opening of merge requests'
do
it
'returns a message regarding opening of merge requests'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'
Test U
ser opened <somewhere.com/merge_requests/100|merge request !100> '
\
'
test.u
ser opened <somewhere.com/merge_requests/100|merge request !100> '
\
'in <somewhere.com|project_name>: *Issue title*'
)
'in <somewhere.com|project_name>: *Issue title*'
)
expect
(
subject
.
attachments
).
to
be_empty
expect
(
subject
.
attachments
).
to
be_empty
end
end
...
@@ -43,7 +43,7 @@ describe SlackService::MergeMessage, models: true do
...
@@ -43,7 +43,7 @@ describe SlackService::MergeMessage, models: true do
end
end
it
'returns a message regarding closing of merge requests'
do
it
'returns a message regarding closing of merge requests'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'
Test U
ser closed <somewhere.com/merge_requests/100|merge request !100> '
\
'
test.u
ser closed <somewhere.com/merge_requests/100|merge request !100> '
\
'in <somewhere.com|project_name>: *Issue title*'
)
'in <somewhere.com|project_name>: *Issue title*'
)
expect
(
subject
.
attachments
).
to
be_empty
expect
(
subject
.
attachments
).
to
be_empty
end
end
...
...
spec/models/project_services/slack_service/note_message_spec.rb
View file @
0b38e213
...
@@ -7,7 +7,7 @@ describe SlackService::NoteMessage, models: true do
...
@@ -7,7 +7,7 @@ describe SlackService::NoteMessage, models: true do
@args
=
{
@args
=
{
user:
{
user:
{
name:
'Test User'
,
name:
'Test User'
,
username:
'
username
'
,
username:
'
test.user
'
,
avatar_url:
'http://fakeavatar'
avatar_url:
'http://fakeavatar'
},
},
project_name:
'project_name'
,
project_name:
'project_name'
,
...
@@ -37,7 +37,7 @@ describe SlackService::NoteMessage, models: true do
...
@@ -37,7 +37,7 @@ describe SlackService::NoteMessage, models: true do
it
'returns a message regarding notes on commits'
do
it
'returns a message regarding notes on commits'
do
message
=
SlackService
::
NoteMessage
.
new
(
@args
)
message
=
SlackService
::
NoteMessage
.
new
(
@args
)
expect
(
message
.
pretext
).
to
eq
(
"
Test U
ser commented on "
\
expect
(
message
.
pretext
).
to
eq
(
"
test.u
ser commented on "
\
"<url|commit 5f163b2b> in <somewhere.com|project_name>: "
\
"<url|commit 5f163b2b> in <somewhere.com|project_name>: "
\
"*Added a commit message*"
)
"*Added a commit message*"
)
expected_attachments
=
[
expected_attachments
=
[
...
@@ -63,7 +63,7 @@ describe SlackService::NoteMessage, models: true do
...
@@ -63,7 +63,7 @@ describe SlackService::NoteMessage, models: true do
it
'returns a message regarding notes on a merge request'
do
it
'returns a message regarding notes on a merge request'
do
message
=
SlackService
::
NoteMessage
.
new
(
@args
)
message
=
SlackService
::
NoteMessage
.
new
(
@args
)
expect
(
message
.
pretext
).
to
eq
(
"
Test U
ser commented on "
\
expect
(
message
.
pretext
).
to
eq
(
"
test.u
ser commented on "
\
"<url|merge request !30> in <somewhere.com|project_name>: "
\
"<url|merge request !30> in <somewhere.com|project_name>: "
\
"*merge request title*"
)
"*merge request title*"
)
expected_attachments
=
[
expected_attachments
=
[
...
@@ -90,7 +90,7 @@ describe SlackService::NoteMessage, models: true do
...
@@ -90,7 +90,7 @@ describe SlackService::NoteMessage, models: true do
it
'returns a message regarding notes on an issue'
do
it
'returns a message regarding notes on an issue'
do
message
=
SlackService
::
NoteMessage
.
new
(
@args
)
message
=
SlackService
::
NoteMessage
.
new
(
@args
)
expect
(
message
.
pretext
).
to
eq
(
expect
(
message
.
pretext
).
to
eq
(
"
Test U
ser commented on "
\
"
test.u
ser commented on "
\
"<url|issue #20> in <somewhere.com|project_name>: "
\
"<url|issue #20> in <somewhere.com|project_name>: "
\
"*issue title*"
)
"*issue title*"
)
expected_attachments
=
[
expected_attachments
=
[
...
@@ -115,7 +115,7 @@ describe SlackService::NoteMessage, models: true do
...
@@ -115,7 +115,7 @@ describe SlackService::NoteMessage, models: true do
it
'returns a message regarding notes on a project snippet'
do
it
'returns a message regarding notes on a project snippet'
do
message
=
SlackService
::
NoteMessage
.
new
(
@args
)
message
=
SlackService
::
NoteMessage
.
new
(
@args
)
expect
(
message
.
pretext
).
to
eq
(
"
Test U
ser commented on "
\
expect
(
message
.
pretext
).
to
eq
(
"
test.u
ser commented on "
\
"<url|snippet #5> in <somewhere.com|project_name>: "
\
"<url|snippet #5> in <somewhere.com|project_name>: "
\
"*snippet title*"
)
"*snippet title*"
)
expected_attachments
=
[
expected_attachments
=
[
...
...
spec/models/project_services/slack_service/push_message_spec.rb
View file @
0b38e213
...
@@ -9,7 +9,7 @@ describe SlackService::PushMessage, models: true do
...
@@ -9,7 +9,7 @@ describe SlackService::PushMessage, models: true do
before:
'before'
,
before:
'before'
,
project_name:
'project_name'
,
project_name:
'project_name'
,
ref:
'refs/heads/master'
,
ref:
'refs/heads/master'
,
user_name:
'
user_name
'
,
user_name:
'
test.user
'
,
project_url:
'url'
project_url:
'url'
}
}
end
end
...
@@ -26,7 +26,7 @@ describe SlackService::PushMessage, models: true do
...
@@ -26,7 +26,7 @@ describe SlackService::PushMessage, models: true do
it
'returns a message regarding pushes'
do
it
'returns a message regarding pushes'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'
user_name
pushed to branch <url/commits/master|master> of '
\
'
test.user
pushed to branch <url/commits/master|master> of '
\
'<url|project_name> (<url/compare/before...after|Compare changes>)'
'<url|project_name> (<url/compare/before...after|Compare changes>)'
)
)
expect
(
subject
.
attachments
).
to
eq
([
expect
(
subject
.
attachments
).
to
eq
([
...
@@ -46,13 +46,13 @@ describe SlackService::PushMessage, models: true do
...
@@ -46,13 +46,13 @@ describe SlackService::PushMessage, models: true do
before:
Gitlab
::
Git
::
BLANK_SHA
,
before:
Gitlab
::
Git
::
BLANK_SHA
,
project_name:
'project_name'
,
project_name:
'project_name'
,
ref:
'refs/tags/new_tag'
,
ref:
'refs/tags/new_tag'
,
user_name:
'
user_name
'
,
user_name:
'
test.user
'
,
project_url:
'url'
project_url:
'url'
}
}
end
end
it
'returns a message regarding pushes'
do
it
'returns a message regarding pushes'
do
expect
(
subject
.
pretext
).
to
eq
(
'
user_name
pushed new tag '
\
expect
(
subject
.
pretext
).
to
eq
(
'
test.user
pushed new tag '
\
'<url/commits/new_tag|new_tag> to '
\
'<url/commits/new_tag|new_tag> to '
\
'<url|project_name>'
)
'<url|project_name>'
)
expect
(
subject
.
attachments
).
to
be_empty
expect
(
subject
.
attachments
).
to
be_empty
...
@@ -66,7 +66,7 @@ describe SlackService::PushMessage, models: true do
...
@@ -66,7 +66,7 @@ describe SlackService::PushMessage, models: true do
it
'returns a message regarding a new branch'
do
it
'returns a message regarding a new branch'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'
user_name
pushed new branch <url/commits/master|master> to '
\
'
test.user
pushed new branch <url/commits/master|master> to '
\
'<url|project_name>'
'<url|project_name>'
)
)
expect
(
subject
.
attachments
).
to
be_empty
expect
(
subject
.
attachments
).
to
be_empty
...
@@ -80,7 +80,7 @@ describe SlackService::PushMessage, models: true do
...
@@ -80,7 +80,7 @@ describe SlackService::PushMessage, models: true do
it
'returns a message regarding a removed branch'
do
it
'returns a message regarding a removed branch'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'
user_name
removed branch master from <url|project_name>'
'
test.user
removed branch master from <url|project_name>'
)
)
expect
(
subject
.
attachments
).
to
be_empty
expect
(
subject
.
attachments
).
to
be_empty
end
end
...
...
spec/models/project_services/slack_service/wiki_page_message_spec.rb
View file @
0b38e213
...
@@ -7,7 +7,7 @@ describe SlackService::WikiPageMessage, models: true do
...
@@ -7,7 +7,7 @@ describe SlackService::WikiPageMessage, models: true do
{
{
user:
{
user:
{
name:
'Test User'
,
name:
'Test User'
,
username:
'
Test U
ser'
username:
'
test.u
ser'
},
},
project_name:
'project_name'
,
project_name:
'project_name'
,
project_url:
'somewhere.com'
,
project_url:
'somewhere.com'
,
...
@@ -25,7 +25,7 @@ describe SlackService::WikiPageMessage, models: true do
...
@@ -25,7 +25,7 @@ describe SlackService::WikiPageMessage, models: true do
it
'returns a message that a new wiki page was created'
do
it
'returns a message that a new wiki page was created'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'
Test U
ser created <url|wiki page> in <somewhere.com|project_name>: '
\
'
test.u
ser created <url|wiki page> in <somewhere.com|project_name>: '
\
'*Wiki page title*'
)
'*Wiki page title*'
)
end
end
end
end
...
@@ -35,7 +35,7 @@ describe SlackService::WikiPageMessage, models: true do
...
@@ -35,7 +35,7 @@ describe SlackService::WikiPageMessage, models: true do
it
'returns a message that a wiki page was updated'
do
it
'returns a message that a wiki page was updated'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'
Test U
ser edited <url|wiki page> in <somewhere.com|project_name>: '
\
'
test.u
ser edited <url|wiki page> in <somewhere.com|project_name>: '
\
'*Wiki page title*'
)
'*Wiki page title*'
)
end
end
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