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
337ced28
Commit
337ced28
authored
Dec 18, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reference triggers.values for permitted parameters
parent
eb5e0e92
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
17 deletions
+33
-17
app/controllers/admin/hooks_controller.rb
app/controllers/admin/hooks_controller.rb
+2
-5
app/controllers/projects/hooks_controller.rb
app/controllers/projects/hooks_controller.rb
+1
-9
spec/controllers/admin/hooks_controller_spec.rb
spec/controllers/admin/hooks_controller_spec.rb
+4
-3
spec/controllers/projects/hooks_controller_spec.rb
spec/controllers/projects/hooks_controller_spec.rb
+26
-0
No files found.
app/controllers/admin/hooks_controller.rb
View file @
337ced28
...
...
@@ -59,12 +59,9 @@ class Admin::HooksController < Admin::ApplicationController
def
hook_params
params
.
require
(
:hook
).
permit
(
:enable_ssl_verification
,
:push_events
,
:tag_push_events
,
:repository_update_events
,
:merge_requests_events
,
:token
,
:url
:url
,
*
SystemHook
.
triggers
.
values
)
end
end
app/controllers/projects/hooks_controller.rb
View file @
337ced28
...
...
@@ -63,18 +63,10 @@ class Projects::HooksController < Projects::ApplicationController
def
hook_params
params
.
require
(
:hook
).
permit
(
:job_events
,
:pipeline_events
,
:enable_ssl_verification
,
:issues_events
,
:confidential_issues_events
,
:merge_requests_events
,
:note_events
,
:push_events
,
:tag_push_events
,
:token
,
:url
,
:wiki_page_event
s
*
ProjectHook
.
triggers
.
value
s
)
end
end
spec/controllers/admin/hooks_controller_spec.rb
View file @
337ced28
...
...
@@ -11,12 +11,13 @@ describe Admin::HooksController do
it
'sets all parameters'
do
hook_params
=
{
enable_ssl_verification:
true
,
token:
"TEST TOKEN"
,
url:
"http://example.com"
,
push_events:
true
,
tag_push_events:
true
,
repository_update_events:
true
,
merge_requests_events:
true
,
token:
"TEST TOKEN"
,
url:
"http://example.com"
merge_requests_events:
true
}
post
:create
,
hook:
hook_params
...
...
spec/controllers/projects/hooks_controller_spec.rb
View file @
337ced28
...
...
@@ -18,4 +18,30 @@ describe Projects::HooksController do
)
end
end
describe
'#create'
do
it
'sets all parameters'
do
hook_params
=
{
enable_ssl_verification:
true
,
token:
"TEST TOKEN"
,
url:
"http://example.com"
,
push_events:
true
,
tag_push_events:
true
,
merge_requests_events:
true
,
issues_events:
true
,
confidential_issues_events:
true
,
note_events:
true
,
job_events:
true
,
pipeline_events:
true
,
wiki_page_events:
true
}
post
:create
,
namespace_id:
project
.
namespace
,
project_id:
project
,
hook:
hook_params
expect
(
response
).
to
have_http_status
(
302
)
expect
(
ProjectHook
.
all
.
size
).
to
eq
(
1
)
expect
(
ProjectHook
.
first
).
to
have_attributes
(
hook_params
)
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