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
b4e2cc44
Commit
b4e2cc44
authored
Sep 12, 2018
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace cond. assignment by default param value
parent
03890558
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
lib/api/runners.rb
lib/api/runners.rb
+3
-5
No files found.
lib/api/runners.rb
View file @
b4e2cc44
...
@@ -14,7 +14,7 @@ module API
...
@@ -14,7 +14,7 @@ module API
use
:pagination
use
:pagination
end
end
get
do
get
do
runners
=
filter_runners
(
current_user
.
ci_owned_runners
,
params
[
:scope
],
only
:
Ci
::
Runner
::
AVAILABLE_STATUSES
)
runners
=
filter_runners
(
current_user
.
ci_owned_runners
,
params
[
:scope
],
allowed_scopes
:
Ci
::
Runner
::
AVAILABLE_STATUSES
)
present
paginate
(
runners
),
with:
Entities
::
Runner
present
paginate
(
runners
),
with:
Entities
::
Runner
end
end
...
@@ -158,12 +158,10 @@ module API
...
@@ -158,12 +158,10 @@ module API
end
end
helpers
do
helpers
do
def
filter_runners
(
runners
,
scope
,
only:
nil
)
def
filter_runners
(
runners
,
scope
,
allowed_scopes:
::
Ci
::
Runner
::
AVAILABLE_SCOPES
)
return
runners
unless
scope
.
present?
return
runners
unless
scope
.
present?
available_scopes
=
only
||
::
Ci
::
Runner
::
AVAILABLE_SCOPES
unless
allowed_scopes
.
include?
(
scope
)
unless
available_scopes
.
include?
(
scope
)
render_api_error!
(
'Scope contains invalid value'
,
400
)
render_api_error!
(
'Scope contains invalid value'
,
400
)
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