Commit cb62eca8 authored by Clement Ho's avatar Clement Ho

Merge branch 'multiple-assignees-fe-sidebar' into multiple-assignees-issue-board-sidebar

parents f3802ae1 7c022ae7
......@@ -23,6 +23,7 @@ export default class SidebarStore {
this.renderedUsers = data.assignees.map(a => {
a.avatarUrl = a.avatar_url;
delete a.avatar_url;
return a;
});
......
......@@ -285,6 +285,22 @@ import eventHub from './sidebar/event_hub';
const previouslySelected = $dropdown.closest('.selectbox')
.find("input[name='" + ($dropdown.data('field-name')) + "'][value!=0]");
// Enables support for limiting the number of users selected
// Automatically removes the first on the list if more users are selected
const maxSelect = $dropdown.data('max-select');
if (maxSelect) {
const selected = getSelected();
if (selected.length > maxSelect) {
const firstSelectedId = selected[0];
const firstSelected = $dropdown.closest('.selectbox')
.find(`input[name='${$dropdown.data('field-name')}'][value=${firstSelectedId}]`);
firstSelected.remove();
eventHub.$emit('sidebar.removeUser', firstSelectedId);
}
}
if (user.beforeDivider && user.name.toLowerCase() === 'unassigned') {
// Unassigned selected
previouslySelected.each((index, element) => {
......
......@@ -65,7 +65,7 @@
- options[:toggle_class] += ' js-multiselect js-save-user-data'
- options[:data][:field_name] = "#{issuable.to_ability_name}[assignee_ids][]"
- options[:data][:multi_select] = true
- options[:data]['dropdown-title'] = 'Select assignee(s)'
- options[:data]['dropdown-title'] = title
- options[:data]['dropdown-header'] = 'Assignee(s)'
- else
- title = 'Select assignee'
......
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