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
839aec1a
Commit
839aec1a
authored
Jul 20, 2016
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace parse_boolean with to_boolean
parent
1cd573ee
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
8 deletions
+4
-8
lib/api/commit_statuses.rb
lib/api/commit_statuses.rb
+1
-1
lib/api/helpers.rb
lib/api/helpers.rb
+1
-5
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+1
-1
lib/api/projects.rb
lib/api/projects.rb
+1
-1
No files found.
lib/api/commit_statuses.rb
View file @
839aec1a
...
...
@@ -24,7 +24,7 @@ module API
pipelines
=
user_project
.
pipelines
.
where
(
sha:
params
[
:sha
])
statuses
=
::
CommitStatus
.
where
(
pipeline:
pipelines
)
statuses
=
statuses
.
latest
unless
parse
_boolean
(
params
[
:all
])
statuses
=
statuses
.
latest
unless
to
_boolean
(
params
[
:all
])
statuses
=
statuses
.
where
(
ref:
params
[
:ref
])
if
params
[
:ref
].
present?
statuses
=
statuses
.
where
(
stage:
params
[
:stage
])
if
params
[
:stage
].
present?
statuses
=
statuses
.
where
(
name:
params
[
:name
])
if
params
[
:name
].
present?
...
...
lib/api/helpers.rb
View file @
839aec1a
...
...
@@ -5,10 +5,6 @@ module API
SUDO_HEADER
=
"HTTP_SUDO"
SUDO_PARAM
=
:sudo
def
parse_boolean
(
value
)
[
true
,
1
,
'1'
,
't'
,
'T'
,
'true'
,
'TRUE'
,
'on'
,
'ON'
].
include?
(
value
)
end
def
to_boolean
(
value
)
return
true
if
value
=~
/^(true|t|yes|y|1|on)$/i
return
false
if
value
=~
/^(false|f|no|n|0|off)$/i
...
...
@@ -297,7 +293,7 @@ module API
def
filter_projects
(
projects
)
# If the archived parameter is passed, limit results accordingly
if
params
[
:archived
].
present?
projects
=
projects
.
where
(
archived:
parse
_boolean
(
params
[
:archived
]))
projects
=
projects
.
where
(
archived:
to
_boolean
(
params
[
:archived
]))
end
if
params
[
:search
].
present?
...
...
lib/api/merge_requests.rb
View file @
839aec1a
...
...
@@ -242,7 +242,7 @@ module API
should_remove_source_branch:
params
[
:should_remove_source_branch
]
}
if
parse
_boolean
(
params
[
:merge_when_build_succeeds
])
&&
merge_request
.
pipeline
&&
merge_request
.
pipeline
.
active?
if
to
_boolean
(
params
[
:merge_when_build_succeeds
])
&&
merge_request
.
pipeline
&&
merge_request
.
pipeline
.
active?
::
MergeRequests
::
MergeWhenBuildSucceedsService
.
new
(
merge_request
.
target_project
,
current_user
,
merge_params
).
execute
(
merge_request
)
else
...
...
lib/api/projects.rb
View file @
839aec1a
...
...
@@ -8,7 +8,7 @@ module API
def
map_public_to_visibility_level
(
attrs
)
publik
=
attrs
.
delete
(
:public
)
if
publik
.
present?
&&
!
attrs
[
:visibility_level
].
present?
publik
=
parse
_boolean
(
publik
)
publik
=
to
_boolean
(
publik
)
# Since setting the public attribute to private could mean either
# private or internal, use the more conservative option, private.
attrs
[
:visibility_level
]
=
(
publik
==
true
)
?
Gitlab
::
VisibilityLevel
::
PUBLIC
:
Gitlab
::
VisibilityLevel
::
PRIVATE
...
...
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