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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
bf7846be
Commit
bf7846be
authored
Feb 22, 2019
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only use boolean parameters internally
Use internally only boolean params.
parent
56a54c62
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
19 deletions
+12
-19
app/controllers/concerns/issuable_collections.rb
app/controllers/concerns/issuable_collections.rb
+1
-1
app/finders/issues_finder.rb
app/finders/issues_finder.rb
+6
-4
lib/api/issues.rb
lib/api/issues.rb
+0
-9
spec/controllers/concerns/issuable_collections_spec.rb
spec/controllers/concerns/issuable_collections_spec.rb
+3
-3
spec/finders/issues_finder_spec.rb
spec/finders/issues_finder_spec.rb
+2
-2
No files found.
app/controllers/concerns/issuable_collections.rb
View file @
bf7846be
...
@@ -91,7 +91,7 @@ module IssuableCollections
...
@@ -91,7 +91,7 @@ module IssuableCollections
options
=
{
options
=
{
scope:
params
[
:scope
],
scope:
params
[
:scope
],
state:
params
[
:state
],
state:
params
[
:state
],
confidential:
params
[
:confidential
]
,
confidential:
Gitlab
::
Utils
.
to_boolean
(
params
[
:confidential
])
,
sort:
set_sort_order
sort:
set_sort_order
}
}
...
...
app/finders/issues_finder.rb
View file @
bf7846be
...
@@ -69,14 +69,16 @@ class IssuesFinder < IssuableFinder
...
@@ -69,14 +69,16 @@ class IssuesFinder < IssuableFinder
end
end
def
filter_items
(
items
)
def
filter_items
(
items
)
issues
=
by_due_date
(
super
)
issues
=
super
by_confidential
(
issues
)
issues
=
by_due_date
(
issues
)
issues
=
by_confidential
(
issues
)
issues
end
end
def
by_confidential
(
items
)
def
by_confidential
(
items
)
return
items
unless
params
[
:confidential
].
present
?
return
items
if
params
[
:confidential
].
nil
?
params
[
:confidential
]
==
'yes'
?
items
.
confidential_only
:
items
.
public_only
params
[
:confidential
]
?
items
.
confidential_only
:
items
.
public_only
end
end
def
by_due_date
(
items
)
def
by_due_date
(
items
)
...
...
lib/api/issues.rb
View file @
bf7846be
...
@@ -15,14 +15,6 @@ module API
...
@@ -15,14 +15,6 @@ module API
params
:issue_params_ee
do
params
:issue_params_ee
do
end
end
def
convert_confidential_param
(
args
)
confidential
=
args
.
delete
(
:confidential
)
return
args
if
confidential
.
nil?
args
[
:confidential
]
=
confidential
?
'yes'
:
'no'
args
end
end
end
helpers
do
helpers
do
...
@@ -34,7 +26,6 @@ module API
...
@@ -34,7 +26,6 @@ module API
args
[
:milestone_title
]
=
args
.
delete
(
:milestone
)
args
[
:milestone_title
]
=
args
.
delete
(
:milestone
)
args
[
:label_name
]
=
args
.
delete
(
:labels
)
args
[
:label_name
]
=
args
.
delete
(
:labels
)
args
[
:scope
]
=
args
[
:scope
].
underscore
if
args
[
:scope
]
args
[
:scope
]
=
args
[
:scope
].
underscore
if
args
[
:scope
]
args
=
convert_confidential_param
(
args
)
issues
=
IssuesFinder
.
new
(
current_user
,
args
).
execute
issues
=
IssuesFinder
.
new
(
current_user
,
args
).
execute
.
preload
(
:assignees
,
:labels
,
:notes
,
:timelogs
,
:project
,
:author
,
:closed_by
)
.
preload
(
:assignees
,
:labels
,
:notes
,
:timelogs
,
:project
,
:author
,
:closed_by
)
...
...
spec/controllers/concerns/issuable_collections_spec.rb
View file @
bf7846be
...
@@ -112,8 +112,8 @@ describe IssuableCollections do
...
@@ -112,8 +112,8 @@ describe IssuableCollections do
assignee_username:
'user1'
,
assignee_username:
'user1'
,
author_id:
'2'
,
author_id:
'2'
,
author_username:
'user2'
,
author_username:
'user2'
,
authorized_only:
'
true
'
,
authorized_only:
'
yes
'
,
confidential:
'yes'
,
confidential:
true
,
due_date:
'2017-01-01'
,
due_date:
'2017-01-01'
,
group_id:
'3'
,
group_id:
'3'
,
iids:
'4'
,
iids:
'4'
,
...
@@ -141,7 +141,7 @@ describe IssuableCollections do
...
@@ -141,7 +141,7 @@ describe IssuableCollections do
'assignee_username'
=>
'user1'
,
'assignee_username'
=>
'user1'
,
'author_id'
=>
'2'
,
'author_id'
=>
'2'
,
'author_username'
=>
'user2'
,
'author_username'
=>
'user2'
,
'confidential'
=>
'yes'
,
'confidential'
=>
true
,
'label_name'
=>
'foo'
,
'label_name'
=>
'foo'
,
'milestone_title'
=>
'bar'
,
'milestone_title'
=>
'bar'
,
'my_reaction_emoji'
=>
'thumbsup'
,
'my_reaction_emoji'
=>
'thumbsup'
,
...
...
spec/finders/issues_finder_spec.rb
View file @
bf7846be
...
@@ -470,7 +470,7 @@ describe IssuesFinder do
...
@@ -470,7 +470,7 @@ describe IssuesFinder do
end
end
context
'user filters confidential issues'
do
context
'user filters confidential issues'
do
let
(
:params
)
{
{
confidential:
'yes'
}
}
let
(
:params
)
{
{
confidential:
true
}
}
it
'returns only confdential issues'
do
it
'returns only confdential issues'
do
expect
(
issues
).
to
contain_exactly
(
confidential_issue
)
expect
(
issues
).
to
contain_exactly
(
confidential_issue
)
...
@@ -478,7 +478,7 @@ describe IssuesFinder do
...
@@ -478,7 +478,7 @@ describe IssuesFinder do
end
end
context
'user filters only public issues'
do
context
'user filters only public issues'
do
let
(
:params
)
{
{
confidential:
'no'
}
}
let
(
:params
)
{
{
confidential:
false
}
}
it
'returns only confdential issues'
do
it
'returns only confdential issues'
do
expect
(
issues
).
to
contain_exactly
(
issue1
,
issue2
,
issue3
,
issue4
)
expect
(
issues
).
to
contain_exactly
(
issue1
,
issue2
,
issue3
,
issue4
)
...
...
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