From 5dde36c025fac1215e03d1f25e634ec73aee1ab4 Mon Sep 17 00:00:00 2001 From: Jose Buitron Date: Thu, 11 Jan 2024 11:41:29 -0500 Subject: [PATCH] fix: closed group membership fixes (#1408) --- src/collaboration/components/MembershipCard.js | 2 +- .../components/GroupSharedDataVisualizationConfig.js | 2 +- src/group/membership/components/GroupMembers.js | 1 + src/group/membership/components/GroupMembers.test.js | 1 + .../components/VisualizationConfigForm/index.js | 11 +++++++---- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/collaboration/components/MembershipCard.js b/src/collaboration/components/MembershipCard.js index 547143630..f14cfdae4 100644 --- a/src/collaboration/components/MembershipCard.js +++ b/src/collaboration/components/MembershipCard.js @@ -84,7 +84,7 @@ const Content = props => { ); } - if (!accountMembership && closedGroup) { + if ((!accountMembership || accountMembership.fetching) && closedGroup) { return ( { const onCompleteSuccess = useCallback( configSlug => { - navigate(`/groups/${slug}/map/${configSlug}`); + navigate(`/groups/${slug}/map/${configSlug}`, { replace: true }); }, [navigate, slug] ); diff --git a/src/group/membership/components/GroupMembers.js b/src/group/membership/components/GroupMembers.js index 573885d49..60bcb1c8c 100644 --- a/src/group/membership/components/GroupMembers.js +++ b/src/group/membership/components/GroupMembers.js @@ -70,6 +70,7 @@ const GroupMembers = () => { groupSlug: group.slug, userEmails: [membership.user.email], userRole: newRole, + membershipStatus: MEMBERSHIP_STATUS_APPROVED, }) ); }, diff --git a/src/group/membership/components/GroupMembers.test.js b/src/group/membership/components/GroupMembers.test.js index 46dd58556..ab702d097 100644 --- a/src/group/membership/components/GroupMembers.test.js +++ b/src/group/membership/components/GroupMembers.test.js @@ -388,6 +388,7 @@ test('GroupMembers: Manager actions', async () => { userEmails: ['email2@email.com'], groupSlug: 'test-group-slug', userRole: 'manager', + membershipStatus: 'APPROVED', }, } ); diff --git a/src/sharedData/visualization/components/VisualizationConfigForm/index.js b/src/sharedData/visualization/components/VisualizationConfigForm/index.js index 050033093..e6cb727a6 100644 --- a/src/sharedData/visualization/components/VisualizationConfigForm/index.js +++ b/src/sharedData/visualization/components/VisualizationConfigForm/index.js @@ -171,10 +171,13 @@ const VisualizationConfigForm = props => { setIsDirty(true); }, []); - const onCompleteSuccessWrapper = useCallback(() => { - onCompleteSuccess(visualizationConfig); - setIsDirty(false); - }, [onCompleteSuccess, visualizationConfig]); + const onCompleteSuccessWrapper = useCallback( + mapSlug => { + onCompleteSuccess(mapSlug); + setIsDirty(false); + }, + [onCompleteSuccess] + ); return ( <>