Commit 32051a46 authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'fix-reassign-quick-action' into 'master'

Include assigned users in /reassign autocomplete

See merge request gitlab-org/gitlab!43383
parents 97e87618 6e1cca98
......@@ -278,11 +278,13 @@ class GfmAutoComplete {
return $.fn.atwho.default.callbacks.filter(query, data, searchKey);
}
if (command === MEMBER_COMMAND.ASSIGN || command === MEMBER_COMMAND.REASSIGN) {
if (command === MEMBER_COMMAND.ASSIGN) {
// Only include members which are not assigned to Issuable currently
return data.filter(
member => member.type === 'User' && !assignees.includes(member.search),
);
} else if (command === MEMBER_COMMAND.REASSIGN) {
return data.filter(member => member.type === 'User');
} else if (command === MEMBER_COMMAND.UNASSIGN) {
// Only include members which are assigned to Issuable currently
return data.filter(member => assignees.includes(member.search));
......
......@@ -65,16 +65,13 @@ const autoCompleteMap = {
SidebarMediator.singleton?.store?.assignees?.map(assignee => assignee.username) || [];
}
if (
doesCurrentLineStartWith('/assign', fullText, selectionStart) ||
doesCurrentLineStartWith('/reassign', fullText, selectionStart)
) {
if (doesCurrentLineStartWith('/assign', fullText, selectionStart)) {
return this.members.filter(
member => member.type === 'User' && !this.assignees.includes(member.username),
);
}
if (doesCurrentLineStartWith('/unassign', fullText, selectionStart)) {
} else if (doesCurrentLineStartWith('/reassign', fullText, selectionStart)) {
return this.members.filter(member => member.type === 'User');
} else if (doesCurrentLineStartWith('/unassign', fullText, selectionStart)) {
return this.members.filter(member => this.assignees.includes(member.username));
}
......
......@@ -30,7 +30,7 @@ RSpec.describe 'GFM autocomplete EE', :js do
wait_for_requests
end
it 'lists users who are currently not assigned to the issue when using /reassign' do
it 'excludes groups when using /reassign' do
note = find('#note-body')
page.within '.timeline-content-form' do
note.native.send_keys('/reas')
......@@ -41,8 +41,8 @@ RSpec.describe 'GFM autocomplete EE', :js do
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(group.name)
expect(find('#at-view-users .atwho-view-ul')).to have_content(user.username)
expect(find('#at-view-users .atwho-view-ul')).to have_content(another_user.username)
end
......@@ -73,7 +73,7 @@ RSpec.describe 'GFM autocomplete EE', :js do
wait_for_requests
end
it 'lists users who are currently not assigned to the issue when using /reassign' do
it 'excludes groups when using /reassign' do
note = find('#note-body')
page.within '.timeline-content-form' do
note.native.send_keys('/reas')
......@@ -85,8 +85,8 @@ RSpec.describe 'GFM autocomplete EE', :js do
wait_for_requests
expect(find('.tribute-container ul', visible: true)).not_to have_content(user.username)
expect(find('.tribute-container ul', visible: true)).not_to have_content(group.name)
expect(find('.tribute-container ul', visible: true)).to have_content(user.username)
expect(find('.tribute-container ul', visible: true)).to have_content(another_user.username)
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