Regression: Users search on `CreateDiscussionView` (#4112)
* fix: users search on `CreateDiscussionView` * chore: increased readability for `getUsers` function
This commit is contained in:
parent
c910f8abe1
commit
08271f6114
|
@ -32,7 +32,10 @@ const SelectUsers = ({
|
||||||
const getUsers = debounce(async (keyword = '') => {
|
const getUsers = debounce(async (keyword = '') => {
|
||||||
try {
|
try {
|
||||||
const res = await RocketChat.search({ text: keyword, filterRooms: false });
|
const res = await RocketChat.search({ text: keyword, filterRooms: false });
|
||||||
setUsers(res);
|
const selectedUsers = users.filter((u: IUser) => selected.includes(u.name));
|
||||||
|
const filteredUsers = res.filter(r => !users.find((u: IUser) => u.name === r.name));
|
||||||
|
const items = [...selectedUsers, ...filteredUsers];
|
||||||
|
setUsers(items);
|
||||||
} catch {
|
} catch {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue