Commit 98c5939e authored by NataliaTepluhina's avatar NataliaTepluhina

Fixed search and filtered out duplicates

parent 6d15237d
...@@ -121,15 +121,18 @@ export default { ...@@ -121,15 +121,18 @@ export default {
}, },
update(data) { update(data) {
const searchResults = data.workspace?.users?.nodes.map(({ user }) => user) || []; const searchResults = data.workspace?.users?.nodes.map(({ user }) => user) || [];
const mergedSearchResults = this.participants.reduce((acc, current) => { const filteredParticipants = this.participants.filter(
if ( (user) =>
!acc.some((user) => current.username === user.username) && user.name.toLowerCase().includes(this.search.toLowerCase()) ||
(current.name.includes(this.search) || current.username.includes(this.search)) user.username.toLowerCase().includes(this.search.toLowerCase()),
) { );
const mergedSearchResults = searchResults.reduce((acc, current) => {
if (!acc.some((user) => current.username === user.username)) {
acc.push(current); acc.push(current);
} }
return acc; return acc;
}, searchResults); }, filteredParticipants);
return mergedSearchResults; return mergedSearchResults;
}, },
debounce: ASSIGNEES_DEBOUNCE_DELAY, debounce: ASSIGNEES_DEBOUNCE_DELAY,
......
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