Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-10-02 13:09:12 +0300
committerRémy Coutable <remy@rymai.me>2018-10-02 13:09:12 +0300
commit974fe0797079f4f7ddc57b45d15ee7d39a06e78a (patch)
tree0dfcc09e301ef2dab1fa43b07295e7d118dc4a33
parentaf0178aa3a59e587aeaea2c8e87e0f5529ddb589 (diff)
parent10534e31622242ee6d6ad4d5502e1f2808979b43 (diff)
Merge branch '41205-fix-filtering-issues' into 'master'
Filter issues without an Assignee via the API Closes #41205 See merge request gitlab-org/gitlab-ce!22009
-rw-r--r--app/finders/issuable_finder.rb6
-rw-r--r--changelogs/unreleased/41205-fix-filtering-issues.yml5
-rw-r--r--spec/finders/issues_finder_spec.rb8
-rw-r--r--spec/requests/api/issues_spec.rb9
4 files changed, 25 insertions, 3 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb
index 251a559878a..0209a1397b9 100644
--- a/app/finders/issuable_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -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
diff --git a/changelogs/unreleased/41205-fix-filtering-issues.yml b/changelogs/unreleased/41205-fix-filtering-issues.yml
new file mode 100644
index 00000000000..ef1a11aad08
--- /dev/null
+++ b/changelogs/unreleased/41205-fix-filtering-issues.yml
@@ -0,0 +1,5 @@
+---
+title: Filter issues without an Assignee via the API
+merge_request: 22009
+author: Eva Kadlecová
+type: fixed
diff --git a/spec/finders/issues_finder_spec.rb b/spec/finders/issues_finder_spec.rb
index 07a2fa86dd7..d78451112ec 100644
--- a/spec/finders/issues_finder_spec.rb
+++ b/spec/finders/issues_finder_spec.rb
@@ -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 } }
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb
index f64815feffa..1e2e13a723c 100644
--- a/spec/requests/api/issues_spec.rb
+++ b/spec/requests/api/issues_spec.rb
@@ -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')