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
Léo-Paul Géneau
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
Hide 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
def
service_params
params
.
require
(
:service
).
permit
(
:title
,
:token
,
:type
,
:active
,
:api_key
,
:subdomain
,
:room
,
:recipients
,
:project_url
,
:room
,
:recipients
,
:project_url
,
:webhook
:user_key
,
:device
,
:priority
,
:sound
)
end
...
...
app/models/project_services/slack_service.rb
View file @
20179772
...
...
@@ -13,10 +13,8 @@
#
class
SlackService
<
Service
prop_accessor
:room
,
:subdomain
,
:token
validates
:room
,
presence:
true
,
if: :activated?
validates
:subdomain
,
presence:
true
,
if: :activated?
validates
:token
,
presence:
true
,
if: :activated?
prop_accessor
:webhook
validates
:webhook
,
presence:
true
,
if: :activated?
def
title
'Slack'
...
...
@@ -32,9 +30,7 @@ class SlackService < Service
def
fields
[
{
type:
'text'
,
name:
'subdomain'
,
placeholder:
''
},
{
type:
'text'
,
name:
'token'
,
placeholder:
''
},
{
type:
'text'
,
name:
'room'
,
placeholder:
'Ex. #general'
},
{
type:
'text'
,
name:
'webhook'
,
placeholder:
''
}
]
end
...
...
@@ -44,9 +40,10 @@ class SlackService < Service
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
.
channel
=
room
notifier
.
username
=
'GitLab'
notifier
.
ping
(
message
.
pretext
,
attachments:
message
.
attachments
)
end
...
...
features/steps/project/services.rb
View file @
20179772
...
...
@@ -108,16 +108,12 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
step
'I fill Slack settings'
do
check
'Active'
fill_in
'Subdomain'
,
with:
'gitlab'
fill_in
'Room'
,
with:
'#gitlab'
fill_in
'Token'
,
with:
'verySecret'
fill_in
'Webhook'
,
with:
'https://gitlabhq.slack.com/services/hooks?token=cdIj4r4LfXUOySDUjp0tk3OI'
click_button
'Save'
end
step
'I should see Slack service settings saved'
do
find_field
(
'Subdomain'
).
value
.
should
==
'gitlab'
find_field
(
'Room'
).
value
.
should
==
'#gitlab'
find_field
(
'Token'
).
value
.
should
==
'verySecret'
find_field
(
'Webhook'
).
value
.
should
==
'https://gitlabhq.slack.com/services/hooks?token=cdIj4r4LfXUOySDUjp0tk3OI'
end
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