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
Tatuya Kamada
gitlab-ce
Commits
3caf7bff
Commit
3caf7bff
authored
Jul 30, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce complexity by extracting it to a method
parent
d27095a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
+20
-17
app/models/project_services/slack_service.rb
app/models/project_services/slack_service.rb
+20
-17
No files found.
app/models/project_services/slack_service.rb
View file @
3caf7bff
...
...
@@ -64,23 +64,7 @@ class SlackService < Service
# 'close' action. Ignore update events for now to prevent duplicate
# messages from arriving.
message
=
\
case
object_kind
when
"push"
,
"tag_push"
PushMessage
.
new
(
data
)
when
"issue"
IssueMessage
.
new
(
data
)
unless
is_update?
(
data
)
when
"merge_request"
MergeMessage
.
new
(
data
)
unless
is_update?
(
data
)
when
"note"
NoteMessage
.
new
(
data
)
when
"build"
BuildMessage
.
new
(
data
)
if
should_build_be_notified?
(
data
)
when
"pipeline"
PipelineMessage
.
new
(
data
)
if
should_pipeline_be_notified?
(
data
)
when
"wiki_page"
WikiPageMessage
.
new
(
data
)
end
message
=
get_message
(
object_kind
,
data
)
opt
=
{}
...
...
@@ -109,6 +93,25 @@ class SlackService < Service
private
def
get_message
(
object_kind
,
data
)
case
object_kind
when
"push"
,
"tag_push"
PushMessage
.
new
(
data
)
when
"issue"
IssueMessage
.
new
(
data
)
unless
is_update?
(
data
)
when
"merge_request"
MergeMessage
.
new
(
data
)
unless
is_update?
(
data
)
when
"note"
NoteMessage
.
new
(
data
)
when
"build"
BuildMessage
.
new
(
data
)
if
should_build_be_notified?
(
data
)
when
"pipeline"
PipelineMessage
.
new
(
data
)
if
should_pipeline_be_notified?
(
data
)
when
"wiki_page"
WikiPageMessage
.
new
(
data
)
end
end
def
get_channel_field
(
event
)
field_name
=
event_channel_name
(
event
)
self
.
public_send
(
field_name
)
...
...
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