Commit 760d6c5f authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera

Merge branch '327822-some-users-are-duplicated-in-issue-assignees-search-results' into 'master'

Resolve "Some users are duplicated in Issue assignees search results"

See merge request gitlab-org/gitlab!59445
parents 0f672aca d2d451b1
...@@ -121,15 +121,20 @@ export default { ...@@ -121,15 +121,20 @@ 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) => {
// Some users are duplicated in the query result:
// https://gitlab.com/gitlab-org/gitlab/-/issues/327822
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