Commit 904832a6 authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera

Merge branch '322960-degredation-in-assigning-team-members-on-boards-view' into 'master'

Fix assignees search to show only project members

See merge request gitlab-org/gitlab!55396
parents 87f57f5a fda71786
query usersSearch($search: String!) {
users(search: $search) {
nodes {
username
name
webUrl
avatarUrl
id
}
}
}
#import "../fragments/user.fragment.graphql" #import "../fragments/user.fragment.graphql"
query usersSearch($search: String!) { query usersSearch($search: String!, $fullPath: ID!) {
users(search: $search) { issuable: project(fullPath: $fullPath) {
nodes { users: projectMembers(search: $search) {
...User nodes {
user {
...User
}
}
} }
} }
} }
...@@ -104,11 +104,22 @@ export default { ...@@ -104,11 +104,22 @@ export default {
query: searchUsers, query: searchUsers,
variables() { variables() {
return { return {
fullPath: this.fullPath,
search: this.search, search: this.search,
}; };
}, },
update(data) { update(data) {
return data.users?.nodes || []; const searchResults = data.issuable?.users?.nodes.map(({ user }) => user) || [];
const mergedSearchResults = this.participants.reduce((acc, current) => {
if (
!acc.some((user) => current.username === user.username) &&
(current.name.includes(this.search) || current.username.includes(this.search))
) {
acc.push(current);
}
return acc;
}, searchResults);
return mergedSearchResults;
}, },
debounce: 250, debounce: 250,
skip() { skip() {
...@@ -185,7 +196,7 @@ export default { ...@@ -185,7 +196,7 @@ export default {
return this.selected.some(isCurrentUser) || this.participants.some(isCurrentUser); return this.selected.some(isCurrentUser) || this.participants.some(isCurrentUser);
}, },
noUsersFound() { noUsersFound() {
return !this.isSearchEmpty && this.unselectedFiltered.length === 0; return !this.isSearchEmpty && this.searchUsers.length === 0;
}, },
showCurrentUser() { showCurrentUser() {
return !this.isCurrentUserInParticipants && (this.isSearchEmpty || this.isSearching); return !this.isCurrentUserInParticipants && (this.isSearchEmpty || this.isSearching);
......
---
title: Fix assignees search to show only project members
merge_request: 55396
author:
type: fixed
...@@ -130,23 +130,29 @@ export const issuableQueryResponse = { ...@@ -130,23 +130,29 @@ export const issuableQueryResponse = {
export const searchQueryResponse = { export const searchQueryResponse = {
data: { data: {
users: { issuable: {
nodes: [ users: {
{ nodes: [
id: '1', {
avatarUrl: '/avatar', user: {
name: 'root', id: '1',
username: 'root', avatarUrl: '/avatar',
webUrl: 'root', name: 'root',
}, username: 'root',
{ webUrl: 'root',
id: '3', },
avatarUrl: '/avatar', },
name: 'rookie', {
username: 'rookie', user: {
webUrl: 'rookie', id: '3',
}, avatarUrl: '/avatar',
], name: 'rookie',
username: 'rookie',
webUrl: 'rookie',
},
},
],
},
}, },
}, },
}; };
......
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