Commit b71d3466 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch...

Merge branch '329750-an-error-occurred-while-fetching-participants-when-clicking-on-board-card-item' into 'master'

Filter `null` users from project/group members

See merge request gitlab-org/gitlab!63167
parents d6cc7c98 4d444e91
......@@ -168,10 +168,12 @@ export default {
})
.then(({ data }) => {
this.users =
data?.project?.projectMembers?.nodes?.map(({ user }) => ({
...user,
id: getIdFromGraphQLId(user.id),
})) || [];
data?.project?.projectMembers?.nodes
.filter((x) => x?.user)
.map(({ user }) => ({
...user,
id: getIdFromGraphQLId(user.id),
})) || [];
return this.users;
})
.finally(() => {
......
......@@ -113,7 +113,7 @@ export default {
update(data) {
// TODO Remove null filter (BE fix required)
// https://gitlab.com/gitlab-org/gitlab/-/issues/329750
return data.workspace?.users?.nodes.filter((x) => x).map(({ user }) => user) || [];
return data.workspace?.users?.nodes.filter((x) => x?.user).map(({ user }) => user) || [];
},
debounce: ASSIGNEES_DEBOUNCE_DELAY,
error({ graphQLErrors }) {
......
......@@ -60,7 +60,9 @@ export default {
search: authorsSearchTerm,
},
})
.then(({ data }) => data.group?.groupMembers.nodes.map((item) => item.user));
.then(({ data }) =>
data.group?.groupMembers.nodes.filter((x) => x?.user).map(({ user }) => user),
);
},
fetchLabels(labelSearchTerm) {
return this.$apollo
......
......@@ -535,14 +535,17 @@ export default {
})
.then(({ data }) => {
const [firstError] = data.workspace.errors || [];
const assignees = data.workspace.assignees.nodes;
const assignees = data.workspace.assignees.nodes
.filter((x) => x?.user)
.map(({ user }) => user);
if (firstError) {
throw new Error(firstError);
}
commit(
types.RECEIVE_ASSIGNEES_SUCCESS,
assignees.map(({ user }) => user),
// User field is nullable and we only want to display non-null users
assignees,
);
})
.catch((e) => {
......
......@@ -94,7 +94,7 @@ export default {
};
},
update({ project: { projectMembers: { nodes = [] } = {} } = {} } = {}) {
return nodes.map(({ user }) => ({ ...user }));
return nodes.filter((x) => x?.user).map(({ user }) => ({ ...user }));
},
error(error) {
this.error = error;
......
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