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
20179772
Commit
20179772
authored
Oct 03, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use only webhook for slack service integration.
parent
86d5a63e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
16 deletions
+9
-16
app/controllers/projects/services_controller.rb
app/controllers/projects/services_controller.rb
+1
-1
app/models/project_services/slack_service.rb
app/models/project_services/slack_service.rb
+6
-9
features/steps/project/services.rb
features/steps/project/services.rb
+2
-6
No files found.
app/controllers/projects/services_controller.rb
View file @
20179772
...
@@ -40,7 +40,7 @@ class Projects::ServicesController < Projects::ApplicationController
...
@@ -40,7 +40,7 @@ class Projects::ServicesController < Projects::ApplicationController
def
service_params
def
service_params
params
.
require
(
:service
).
permit
(
params
.
require
(
:service
).
permit
(
:title
,
:token
,
:type
,
:active
,
:api_key
,
:subdomain
,
:title
,
:token
,
:type
,
:active
,
:api_key
,
:subdomain
,
:room
,
:recipients
,
:project_url
,
:room
,
:recipients
,
:project_url
,
:webhook
:user_key
,
:device
,
:priority
,
:sound
:user_key
,
:device
,
:priority
,
:sound
)
)
end
end
...
...
app/models/project_services/slack_service.rb
View file @
20179772
...
@@ -13,10 +13,8 @@
...
@@ -13,10 +13,8 @@
#
#
class
SlackService
<
Service
class
SlackService
<
Service
prop_accessor
:room
,
:subdomain
,
:token
prop_accessor
:webhook
validates
:room
,
presence:
true
,
if: :activated?
validates
:webhook
,
presence:
true
,
if: :activated?
validates
:subdomain
,
presence:
true
,
if: :activated?
validates
:token
,
presence:
true
,
if: :activated?
def
title
def
title
'Slack'
'Slack'
...
@@ -32,9 +30,7 @@ class SlackService < Service
...
@@ -32,9 +30,7 @@ class SlackService < Service
def
fields
def
fields
[
[
{
type:
'text'
,
name:
'subdomain'
,
placeholder:
''
},
{
type:
'text'
,
name:
'webhook'
,
placeholder:
''
}
{
type:
'text'
,
name:
'token'
,
placeholder:
''
},
{
type:
'text'
,
name:
'room'
,
placeholder:
'Ex. #general'
},
]
]
end
end
...
@@ -44,9 +40,10 @@ class SlackService < Service
...
@@ -44,9 +40,10 @@ class SlackService < Service
project_name:
project_name
project_name:
project_name
))
))
credentials
=
webhook
.
match
(
/(\w*).slack.com.*token=(\w*)/
)
subdomain
=
credentials
[
1
]
token
=
credentials
[
2
]
notifier
=
Slack
::
Notifier
.
new
(
subdomain
,
token
)
notifier
=
Slack
::
Notifier
.
new
(
subdomain
,
token
)
notifier
.
channel
=
room
notifier
.
username
=
'GitLab'
notifier
.
ping
(
message
.
pretext
,
attachments:
message
.
attachments
)
notifier
.
ping
(
message
.
pretext
,
attachments:
message
.
attachments
)
end
end
...
...
features/steps/project/services.rb
View file @
20179772
...
@@ -108,16 +108,12 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
...
@@ -108,16 +108,12 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
step
'I fill Slack settings'
do
step
'I fill Slack settings'
do
check
'Active'
check
'Active'
fill_in
'Subdomain'
,
with:
'gitlab'
fill_in
'Webhook'
,
with:
'https://gitlabhq.slack.com/services/hooks?token=cdIj4r4LfXUOySDUjp0tk3OI'
fill_in
'Room'
,
with:
'#gitlab'
fill_in
'Token'
,
with:
'verySecret'
click_button
'Save'
click_button
'Save'
end
end
step
'I should see Slack service settings saved'
do
step
'I should see Slack service settings saved'
do
find_field
(
'Subdomain'
).
value
.
should
==
'gitlab'
find_field
(
'Webhook'
).
value
.
should
==
'https://gitlabhq.slack.com/services/hooks?token=cdIj4r4LfXUOySDUjp0tk3OI'
find_field
(
'Room'
).
value
.
should
==
'#gitlab'
find_field
(
'Token'
).
value
.
should
==
'verySecret'
end
end
step
'I click Pushover service link'
do
step
'I click Pushover service link'
do
...
...
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