Commit f7599ef0 authored by Valery Sizov's avatar Valery Sizov

Filter issues by multiple assignee. Intargrate BE and FE parts

parent 64cbe0a2
...@@ -26,7 +26,7 @@ class IssuableFinder ...@@ -26,7 +26,7 @@ class IssuableFinder
IRRELEVANT_PARAMS_FOR_CACHE_KEY = %i[utf8 sort page state].freeze IRRELEVANT_PARAMS_FOR_CACHE_KEY = %i[utf8 sort page state].freeze
SCALAR_PARAMS = %i(scope state group_id project_id milestone_title assignee_id search label_name sort assignee_username author_id author_username authorized_only due_date iids non_archived weight).freeze SCALAR_PARAMS = %i(scope state group_id project_id milestone_title assignee_id search label_name sort assignee_username author_id author_username authorized_only due_date iids non_archived weight).freeze
ARRAY_PARAMS = { label_name: [], iids: [] }.freeze ARRAY_PARAMS = { label_name: [], iids: [], assignee_username: [] }.freeze
VALID_PARAMS = (SCALAR_PARAMS + [ARRAY_PARAMS]).freeze VALID_PARAMS = (SCALAR_PARAMS + [ARRAY_PARAMS]).freeze
attr_accessor :current_user, :params attr_accessor :current_user, :params
......
...@@ -118,8 +118,8 @@ class IssuesFinder < IssuableFinder ...@@ -118,8 +118,8 @@ class IssuesFinder < IssuableFinder
@assignees = @assignees =
if params[:assignee_ids] if params[:assignee_ids]
User.where(id: params[:assignee_ids]) User.where(id: params[:assignee_ids])
elsif params[:assignee_usernames] elsif params[:assignee_username]
User.where(username: params[:assignee_usernames]) User.where(username: params[:assignee_username])
else else
[] []
end end
......
...@@ -196,7 +196,17 @@ describe 'Filter issues', js: true do ...@@ -196,7 +196,17 @@ describe 'Filter issues', js: true do
end end
it 'filters issues by multiple assignees' do it 'filters issues by multiple assignees' do
skip('to be tested, issue #26546') create(:issue, project: project, author: user, assignees: [user2, user])
input_filtered_search("assignee:@#{user.username} assignee:@#{user2.username}")
expect_tokens([
assignee_token(user.name),
assignee_token(user2.name)
])
expect_issues_list_count(1)
expect_filtered_search_input_empty
end end
end end
......
...@@ -64,7 +64,7 @@ describe IssuesFinder do ...@@ -64,7 +64,7 @@ describe IssuesFinder do
let(:params) { { assignee_ids: [user2.id, user3.id] } } let(:params) { { assignee_ids: [user2.id, user3.id] } }
before do before do
project2.team << [user3, :developer] project2.add_developer(user3)
issue3.assignees = [user2, user3] issue3.assignees = [user2, user3]
end end
...@@ -76,10 +76,10 @@ describe IssuesFinder do ...@@ -76,10 +76,10 @@ describe IssuesFinder do
context 'filtering by assignee usernames' do context 'filtering by assignee usernames' do
set(:user3) { create(:user) } set(:user3) { create(:user) }
let(:params) { { assignee_usernames: [user2.username, user3.username] } } let(:params) { { assignee_username: [user2.username, user3.username] } }
before do before do
project2.team << [user3, :developer] project2.add_developer(user3)
issue3.assignees = [user2, user3] issue3.assignees = [user2, user3]
end end
......
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