Commit 3ae0a8bf authored by Mario Celi's avatar Mario Celi

Do not return empty issues if negated assignee does not exist

parent e5845760
......@@ -395,8 +395,6 @@ class IssuableFinder
# We want CE users to be able to say "Issues not assigned to either PersonA nor PersonB"
if not_params.assignees.present?
items.not_assigned_to(not_params.assignees)
elsif not_params.assignee_id? || not_params.assignee_username? # assignee not found
items.none
else
items
end
......
......@@ -49,6 +49,13 @@ RSpec.describe IssuesFinder do
let(:expected_issuables) { [issue3, issue4] }
end
context 'when assignee_id does not exist' do
it_behaves_like 'assignee NOT ID filter' do
let(:params) { { not: { assignee_id: -100 } } }
let(:expected_issuables) { [issue1, issue2, issue3, issue4, issue5] }
end
end
context 'filter by username' do
let_it_be(:user3) { create(:user) }
......@@ -76,6 +83,17 @@ RSpec.describe IssuesFinder do
let(:params) { { not: { assignee_username: [user.username, user2.username] } } }
let(:expected_issuables) { [issue3, issue4] }
end
context 'when assignee_username does not exist' do
it_behaves_like 'assignee NOT username filter' do
before do
issue2.assignees = [user2]
end
let(:params) { { not: { assignee_username: 'non_existent_username' } } }
let(:expected_issuables) { [issue1, issue2, issue3, issue4, issue5] }
end
end
end
it_behaves_like 'no assignee filter' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment