From 82bca031622a0062953fae18c15202bf5245d0f1 Mon Sep 17 00:00:00 2001 From: Tuan Dang Date: Tue, 16 Jul 2024 14:31:40 +0700 Subject: [PATCH] Filter out only projects that are part of current org in identity project modal --- .../IdentityProjectsSection/IdentityAddToProjectModal.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/Org/IdentityPage/components/IdentityProjectsSection/IdentityAddToProjectModal.tsx b/frontend/src/views/Org/IdentityPage/components/IdentityProjectsSection/IdentityAddToProjectModal.tsx index ca51d2845c..58697afcc3 100644 --- a/frontend/src/views/Org/IdentityPage/components/IdentityProjectsSection/IdentityAddToProjectModal.tsx +++ b/frontend/src/views/Org/IdentityPage/components/IdentityProjectsSection/IdentityAddToProjectModal.tsx @@ -5,7 +5,7 @@ import { z } from "zod"; import { createNotification } from "@app/components/notifications"; import { Button, FormControl, Modal, ModalContent, Select, SelectItem } from "@app/components/v2"; -import { useWorkspace } from "@app/context"; +import { useOrganization,useWorkspace } from "@app/context"; import { useAddIdentityToWorkspace, useGetIdentityProjectMemberships, @@ -33,6 +33,7 @@ type Props = { }; export const IdentityAddToProjectModal = ({ identityId, popUp, handlePopUpToggle }: Props) => { + const { currentOrg } = useOrganization(); const { workspaces } = useWorkspace(); const { mutateAsync: addIdentityToWorkspace } = useAddIdentityToWorkspace(); @@ -58,7 +59,9 @@ export const IdentityAddToProjectModal = ({ identityId, popUp, handlePopUpToggle wsWorkspaceIds.set(projectMembership.project.id, true); }); - return (workspaces || []).filter(({ id }) => !wsWorkspaceIds.has(id)); + return (workspaces || []).filter( + ({ id, orgId }) => !wsWorkspaceIds.has(id) && orgId === currentOrg?.id + ); }, [workspaces, projectMemberships]); const onFormSubmit = async ({ projectId: workspaceId, role }: FormData) => {