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
10534e31
Commit
10534e31
authored
Sep 30, 2018
by
Eva Kadlecová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter issues without an Assignee via the API
parent
227cc997
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
3 deletions
+25
-3
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+3
-3
changelogs/unreleased/41205-fix-filtering-issues.yml
changelogs/unreleased/41205-fix-filtering-issues.yml
+5
-0
spec/finders/issues_finder_spec.rb
spec/finders/issues_finder_spec.rb
+8
-0
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+9
-0
No files found.
app/finders/issuable_finder.rb
View file @
10534e31
...
...
@@ -236,16 +236,16 @@ class IssuableFinder
# rubocop: enable CodeReuse/ActiveRecord
def
assignee_id?
params
[
:assignee_id
].
present?
&&
params
[
:assignee_id
]
!=
NONE
params
[
:assignee_id
].
present?
&&
params
[
:assignee_id
]
.
to_s
!=
NONE
end
def
assignee_username?
params
[
:assignee_username
].
present?
&&
params
[
:assignee_username
]
!=
NONE
params
[
:assignee_username
].
present?
&&
params
[
:assignee_username
]
.
to_s
!=
NONE
end
def
no_assignee?
# Assignee_id takes precedence over assignee_username
params
[
:assignee_id
]
==
NONE
||
params
[
:assignee_username
]
==
NONE
params
[
:assignee_id
]
.
to_s
==
NONE
||
params
[
:assignee_username
].
to_s
==
NONE
end
# rubocop: disable CodeReuse/ActiveRecord
...
...
changelogs/unreleased/41205-fix-filtering-issues.yml
0 → 100644
View file @
10534e31
---
title
:
Filter issues without an Assignee via the API
merge_request
:
22009
author
:
Eva Kadlecová
type
:
fixed
spec/finders/issues_finder_spec.rb
View file @
10534e31
...
...
@@ -56,6 +56,14 @@ describe IssuesFinder do
end
end
context
'filtering by no assignee'
do
let
(
:params
)
{
{
assignee_id:
0
}
}
it
'returns issues not assign to any assignee'
do
expect
(
issues
).
to
contain_exactly
(
issue4
)
end
end
context
'filtering by group_id'
do
let
(
:params
)
{
{
group_id:
group
.
id
}
}
...
...
spec/requests/api/issues_spec.rb
View file @
10534e31
...
...
@@ -168,6 +168,15 @@ describe API::Issues do
expect
(
first_issue
[
'id'
]).
to
eq
(
issue2
.
id
)
end
it
'returns issues with no assignee'
do
issue2
=
create
(
:issue
,
author:
user2
,
project:
project
)
get
api
(
'/issues'
,
user
),
assignee_id:
0
,
scope:
'all'
expect_paginated_array_response
(
size:
1
)
expect
(
first_issue
[
'id'
]).
to
eq
(
issue2
.
id
)
end
it
'returns issues reacted by the authenticated user by the given emoji'
do
issue2
=
create
(
:issue
,
project:
project
,
author:
user
,
assignees:
[
user
])
award_emoji
=
create
(
:award_emoji
,
awardable:
issue2
,
user:
user2
,
name:
'star'
)
...
...
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