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
Jérome Perrin
gitlab-ce
Commits
36fa5d66
Commit
36fa5d66
authored
Nov 14, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'grapify-to-h' into 'master'
Use to_h to convert params to a hash See merge request !7406
parents
7e34f7fc
510092c8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
lib/api/helpers.rb
lib/api/helpers.rb
+5
-0
lib/api/milestones.rb
lib/api/milestones.rb
+3
-4
lib/api/runners.rb
lib/api/runners.rb
+1
-3
No files found.
lib/api/helpers.rb
View file @
36fa5d66
...
...
@@ -23,6 +23,11 @@ module API
warden
.
try
(
:authenticate
)
if
%w[GET HEAD]
.
include?
(
env
[
'REQUEST_METHOD'
])
end
def
declared_params
(
options
=
{})
options
=
{
include_parent_namespaces:
false
}.
merge
(
options
)
declared
(
params
,
options
).
to_h
.
symbolize_keys
end
def
find_user_by_private_token
token
=
private_token
return
nil
unless
token
.
present?
...
...
lib/api/milestones.rb
View file @
36fa5d66
...
...
@@ -62,9 +62,8 @@ module API
end
post
":id/milestones"
do
authorize!
:admin_milestone
,
user_project
milestone_params
=
declared
(
params
,
include_parent_namespaces:
false
)
milestone
=
::
Milestones
::
CreateService
.
new
(
user_project
,
current_user
,
milestone
_params
).
execute
milestone
=
::
Milestones
::
CreateService
.
new
(
user_project
,
current_user
,
declared
_params
).
execute
if
milestone
.
valid?
present
milestone
,
with:
Entities
::
Milestone
...
...
@@ -86,9 +85,9 @@ module API
end
put
":id/milestones/:milestone_id"
do
authorize!
:admin_milestone
,
user_project
milestone
_params
=
declared
(
params
,
include_parent_namespaces:
false
,
include_missing:
false
)
milestone
=
user_project
.
milestones
.
find
(
params
.
delete
(
:milestone_id
)
)
milestone
=
user_project
.
milestones
.
find
(
milestone_params
.
delete
(
:milestone_id
)
)
milestone
_params
=
declared_params
(
include_missing:
false
)
milestone
=
::
Milestones
::
UpdateService
.
new
(
user_project
,
current_user
,
milestone_params
).
execute
(
milestone
)
if
milestone
.
valid?
...
...
lib/api/runners.rb
View file @
36fa5d66
...
...
@@ -57,9 +57,7 @@ module API
runner
=
get_runner
(
params
.
delete
(
:id
))
authenticate_update_runner!
(
runner
)
runner_params
=
declared
(
params
,
include_missing:
false
)
if
runner
.
update
(
runner_params
)
if
runner
.
update
(
declared_params
(
include_missing:
false
))
present
runner
,
with:
Entities
::
RunnerDetails
,
current_user:
current_user
else
render_validation_error!
(
runner
)
...
...
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