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
ff627511
Commit
ff627511
authored
Apr 19, 2019
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add label_name as scalar param of IssuableFinder
This was removed by a previous MR but broke some links
parent
46bdbc5d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
42 deletions
+74
-42
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+1
-0
changelogs/unreleased/60569-timeline-entry-label-link-is-not-applying-the-filter-on-issues.yml
...entry-label-link-is-not-applying-the-filter-on-issues.yml
+5
-0
spec/controllers/concerns/issuable_collections_spec.rb
spec/controllers/concerns/issuable_collections_spec.rb
+68
-42
No files found.
app/finders/issuable_finder.rb
View file @
ff627511
...
...
@@ -53,6 +53,7 @@ class IssuableFinder
assignee_username
author_id
author_username
label_name
milestone_title
my_reaction_emoji
search
...
...
changelogs/unreleased/60569-timeline-entry-label-link-is-not-applying-the-filter-on-issues.yml
0 → 100644
View file @
ff627511
---
title
:
Fix filtering of labels from system note link
merge_request
:
27507
author
:
type
:
fixed
spec/controllers/concerns/issuable_collections_spec.rb
View file @
ff627511
...
...
@@ -108,51 +108,77 @@ describe IssuableCollections do
end
describe
'#finder_options'
do
let
(
:params
)
do
{
assignee_id:
'1'
,
assignee_username:
'user1'
,
author_id:
'2'
,
author_username:
'user2'
,
authorized_only:
'yes'
,
confidential:
true
,
due_date:
'2017-01-01'
,
group_id:
'3'
,
iids:
'4'
,
label_name:
[
'foo'
],
milestone_title:
'bar'
,
my_reaction_emoji:
'thumbsup'
,
non_archived:
'true'
,
project_id:
'5'
,
scope:
'all'
,
search:
'baz'
,
sort:
'priority'
,
state:
'opened'
,
invalid_param:
'invalid_param'
}
end
it
'only allows whitelisted params'
do
before
do
allow
(
controller
).
to
receive
(
:cookies
).
and_return
({})
allow
(
controller
).
to
receive
(
:current_user
).
and_return
(
nil
)
end
subject
{
controller
.
send
(
:finder_options
).
to_h
}
context
'scalar params'
do
let
(
:params
)
do
{
assignee_id:
'1'
,
assignee_username:
'user1'
,
author_id:
'2'
,
author_username:
'user2'
,
authorized_only:
'yes'
,
confidential:
true
,
due_date:
'2017-01-01'
,
group_id:
'3'
,
iids:
'4'
,
label_name:
'foo'
,
milestone_title:
'bar'
,
my_reaction_emoji:
'thumbsup'
,
non_archived:
'true'
,
project_id:
'5'
,
scope:
'all'
,
search:
'baz'
,
sort:
'priority'
,
state:
'opened'
,
invalid_param:
'invalid_param'
}
end
it
'only allows whitelisted params'
do
is_expected
.
to
include
({
'assignee_id'
=>
'1'
,
'assignee_username'
=>
'user1'
,
'author_id'
=>
'2'
,
'author_username'
=>
'user2'
,
'confidential'
=>
true
,
'label_name'
=>
'foo'
,
'milestone_title'
=>
'bar'
,
'my_reaction_emoji'
=>
'thumbsup'
,
'due_date'
=>
'2017-01-01'
,
'scope'
=>
'all'
,
'search'
=>
'baz'
,
'sort'
=>
'priority'
,
'state'
=>
'opened'
})
is_expected
.
not_to
include
(
'invalid_param'
)
end
end
context
'array params'
do
let
(
:params
)
do
{
assignee_username:
%w[user1 user2]
,
label_name:
%w[label1 label2]
,
invalid_param:
'invalid_param'
,
invalid_array:
[
'param'
]
}
end
it
'only allows whitelisted params'
do
is_expected
.
to
include
({
'label_name'
=>
%w[label1 label2]
,
'assignee_username'
=>
%w[user1 user2]
})
finder_options
=
controller
.
send
(
:finder_options
)
expect
(
finder_options
).
to
eq
(
ActionController
::
Parameters
.
new
({
'assignee_id'
=>
'1'
,
'assignee_username'
=>
'user1'
,
'author_id'
=>
'2'
,
'author_username'
=>
'user2'
,
'confidential'
=>
true
,
'label_name'
=>
[
'foo'
],
'milestone_title'
=>
'bar'
,
'my_reaction_emoji'
=>
'thumbsup'
,
'due_date'
=>
'2017-01-01'
,
'scope'
=>
'all'
,
'search'
=>
'baz'
,
'sort'
=>
'priority'
,
'state'
=>
'opened'
}).
permit!
)
is_expected
.
not_to
include
(
'invalid_param'
,
'invalid_array'
)
end
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