Commit 56512cc1 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'current-user-filter-top' into 'master'

Shows current user on top of filtered dropdown list

Closes #26765

See merge request !8612
parents 270dc226 92682b8a
...@@ -18,7 +18,7 @@ class AutocompleteController < ApplicationController ...@@ -18,7 +18,7 @@ class AutocompleteController < ApplicationController
if params[:search].blank? if params[:search].blank?
# Include current user if available to filter by "Me" # Include current user if available to filter by "Me"
if params[:current_user].present? && current_user if params[:current_user].present? && current_user
@users = [*@users, current_user] @users = [current_user, *@users]
end end
if params[:author_id].present? if params[:author_id].present?
......
...@@ -66,6 +66,12 @@ describe 'Dropdown assignee', js: true, feature: true do ...@@ -66,6 +66,12 @@ describe 'Dropdown assignee', js: true, feature: true do
expect(dropdown_assignee_size).to eq(3) expect(dropdown_assignee_size).to eq(3)
end end
it 'shows current user at top of dropdown' do
send_keys_to_filtered_search('assignee:')
expect(first('#js-dropdown-assignee .filter-dropdown li')).to have_content(user.name)
end
end end
describe 'filtering' do describe 'filtering' do
......
...@@ -66,6 +66,12 @@ describe 'Dropdown author', js: true, feature: true do ...@@ -66,6 +66,12 @@ describe 'Dropdown author', js: true, feature: true do
expect(dropdown_author_size).to eq(3) expect(dropdown_author_size).to eq(3)
end end
it 'shows current user at top of dropdown' do
send_keys_to_filtered_search('author:')
expect(first('#js-dropdown-author li')).to have_content(user.name)
end
end end
describe 'filtering' do describe 'filtering' 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