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 { ...@@ -278,13 +278,11 @@ class GfmAutoComplete {
return $.fn.atwho.default.callbacks.filter(query, data, searchKey); 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 // Only include members which are not assigned to Issuable currently
return data.filter( return data.filter(
member => member.type === 'User' && !assignees.includes(member.search), 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) { } else if (command === MEMBER_COMMAND.UNASSIGN) {
// Only include members which are assigned to Issuable currently // Only include members which are assigned to Issuable currently
return data.filter(member => assignees.includes(member.search)); return data.filter(member => assignees.includes(member.search));
......
...@@ -65,13 +65,16 @@ const autoCompleteMap = { ...@@ -65,13 +65,16 @@ const autoCompleteMap = {
SidebarMediator.singleton?.store?.assignees?.map(assignee => assignee.username) || []; 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( return this.members.filter(
member => member.type === 'User' && !this.assignees.includes(member.username), 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)); return this.members.filter(member => this.assignees.includes(member.username));
} }
......
...@@ -30,7 +30,7 @@ RSpec.describe 'GFM autocomplete EE', :js do ...@@ -30,7 +30,7 @@ RSpec.describe 'GFM autocomplete EE', :js do
wait_for_requests wait_for_requests
end 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') note = find('#note-body')
page.within '.timeline-content-form' do page.within '.timeline-content-form' do
note.native.send_keys('/reas') note.native.send_keys('/reas')
...@@ -41,8 +41,8 @@ RSpec.describe 'GFM autocomplete EE', :js do ...@@ -41,8 +41,8 @@ RSpec.describe 'GFM autocomplete EE', :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(group.name) 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) expect(find('#at-view-users .atwho-view-ul')).to have_content(another_user.username)
end end
...@@ -73,7 +73,7 @@ RSpec.describe 'GFM autocomplete EE', :js do ...@@ -73,7 +73,7 @@ RSpec.describe 'GFM autocomplete EE', :js do
wait_for_requests wait_for_requests
end 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') note = find('#note-body')
page.within '.timeline-content-form' do page.within '.timeline-content-form' do
note.native.send_keys('/reas') note.native.send_keys('/reas')
...@@ -85,8 +85,8 @@ RSpec.describe 'GFM autocomplete EE', :js do ...@@ -85,8 +85,8 @@ RSpec.describe 'GFM autocomplete EE', :js do
wait_for_requests 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)).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) expect(find('.tribute-container ul', visible: true)).to have_content(another_user.username)
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