feat: show user display name when searching for assignees on a list

This commit is contained in:
kolaente 2022-09-07 17:05:44 +02:00
parent 2e84c27d1e
commit 65fd2f14a0
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -10,7 +10,7 @@
@search="findUser" @search="findUser"
:search-results="foundUsers" :search-results="foundUsers"
@select="addAssignee" @select="addAssignee"
label="username" label="name"
:select-placeholder="$t('task.assignee.selectPlaceholder')" :select-placeholder="$t('task.assignee.selectPlaceholder')"
v-model="assignees" v-model="assignees"
ref="multiselect" ref="multiselect"
@ -106,6 +106,11 @@ async function findUser(query: string) {
// Filter the results to not include users who are already assigned // Filter the results to not include users who are already assigned
foundUsers.value = response.filter(({id}) => !includesById(assignees.value, id)) foundUsers.value = response.filter(({id}) => !includesById(assignees.value, id))
.map(u => {
// Users may not have a display name set, so we fall back on the username in that case
u.name = u.name === '' ? u.username : u.name
return u
})
} }
function clearAllFoundUsers() { function clearAllFoundUsers() {