Commit e52da1e7 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch '210005-fix-assignee-quickaction-on-new-issue' into 'master'

Resolve "Assign quick action does not load the list of users"

Closes #210005

See merge request gitlab-org/gitlab!26971
parents 25b8e679 9b520784
...@@ -251,9 +251,10 @@ class GfmAutoComplete { ...@@ -251,9 +251,10 @@ class GfmAutoComplete {
}); });
// Cache assignees list for easier filtering later // Cache assignees list for easier filtering later
assignees = SidebarMediator.singleton?.store?.assignees?.map( assignees =
SidebarMediator.singleton?.store?.assignees?.map(
assignee => `${assignee.username} ${assignee.name}`, assignee => `${assignee.username} ${assignee.name}`,
); ) || [];
const match = GfmAutoComplete.defaultMatcher(flag, subtext, this.app.controllers); const match = GfmAutoComplete.defaultMatcher(flag, subtext, this.app.controllers);
return match && match.length ? match[1] : null; return match && match.length ? match[1] : null;
......
---
title: Fix assignee dropdown on new issue page
merge_request: 26971
author:
type: fixed
...@@ -284,16 +284,17 @@ describe 'GFM autocomplete', :js do ...@@ -284,16 +284,17 @@ describe 'GFM autocomplete', :js do
context 'assignees' do context 'assignees' do
let(:issue_assignee) { create(:issue, project: project) } let(:issue_assignee) { create(:issue, project: project) }
let(:unassigned_user) { create(:user) }
before do before do
issue_assignee.update(assignees: [user]) issue_assignee.update(assignees: [user])
visit project_issue_path(project, issue_assignee) project.add_maintainer(unassigned_user)
wait_for_requests
end end
it 'lists users who are currently not assigned to the issue when using /assign' do it 'lists users who are currently not assigned to the issue when using /assign' do
visit project_issue_path(project, issue_assignee)
note = find('#note-body') note = find('#note-body')
page.within '.timeline-content-form' do page.within '.timeline-content-form' do
note.native.send_keys('/as') note.native.send_keys('/as')
...@@ -305,6 +306,19 @@ describe 'GFM autocomplete', :js do ...@@ -305,6 +306,19 @@ describe 'GFM autocomplete', :js do
wait_for_requests wait_for_requests
expect(find('#at-view-users .atwho-view-ul')).not_to have_content(user.username) expect(find('#at-view-users .atwho-view-ul')).not_to have_content(user.username)
expect(find('#at-view-users .atwho-view-ul')).to have_content(unassigned_user.username)
end
it 'shows dropdown on new issue form' do
visit new_project_issue_path(project)
textarea = find('#issue_description')
textarea.native.send_keys('/ass')
find('.atwho-view li', text: '/assign')
textarea.native.send_keys(:tab)
expect(find('#at-view-users .atwho-view-ul')).to have_content(unassigned_user.username)
expect(find('#at-view-users .atwho-view-ul')).to have_content(user.username)
end end
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