Commit 2b719022 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Revert "Include assigned users in /reassign autocomplete"

This reverts commit 6e1cca98.
parent 5d673390
......@@ -278,13 +278,11 @@ class GfmAutoComplete {
return $.fn.atwho.default.callbacks.filter(query, data, searchKey);
}
if (command === MEMBER_COMMAND.ASSIGN) {
if (command === MEMBER_COMMAND.ASSIGN || command === MEMBER_COMMAND.REASSIGN) {
// 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,13 +65,16 @@ const autoCompleteMap = {
SidebarMediator.singleton?.store?.assignees?.map(assignee => assignee.username) || [];
}
if (doesCurrentLineStartWith('/assign', fullText, selectionStart)) {
if (
doesCurrentLineStartWith('/assign', fullText, selectionStart) ||
doesCurrentLineStartWith('/reassign', fullText, selectionStart)
) {
return this.members.filter(
member => member.type === 'User' && !this.assignees.includes(member.username),
);
} else if (doesCurrentLineStartWith('/reassign', fullText, selectionStart)) {
return this.members.filter(member => member.type === 'User');
} else if (doesCurrentLineStartWith('/unassign', fullText, selectionStart)) {
}
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 'excludes groups when using /reassign' do
it 'lists users who are currently not assigned to the issue 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 'excludes groups when using /reassign' do
it 'lists users who are currently not assigned to the issue 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