fix(task): make sure users can be assigned via quick add magic via their real name as well
continuous-integration/drone/push Build is failing Details

See #2196 (comment)
This commit is contained in:
kolaente 2022-09-30 21:20:26 +02:00
parent 72b731d620
commit f8450f58a4
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 6 additions and 4 deletions

View File

@ -38,9 +38,11 @@ function findPropertyByValue(object, key, value) {
)
}
// Check if the user exists
function validateUsername(users: IUser[], username: IUser['username']) {
return findPropertyByValue(users, 'username', username)
// Check if the user exists in the search results
function validateUser(users: IUser[], username: IUser['username']) {
return findPropertyByValue(users, 'username', username) ||
findPropertyByValue(users, 'name', username) ||
findPropertyByValue(users, 'email', username)
}
// Check if the label exists
@ -67,7 +69,7 @@ async function findAssignees(parsedTaskAssignees: string[]) {
const userService = new UserService()
const assignees = parsedTaskAssignees.map(async a => {
const users = await userService.getAll({}, {s: a})
return validateUsername(users, a)
return validateUser(users, a)
})
const validatedUsers = await Promise.all(assignees)