diff --git a/src/collaboration/components/MembershipJoinLeaveButton.js b/src/collaboration/components/MembershipJoinLeaveButton.js index c9d0c03fc5..2552c55d75 100644 --- a/src/collaboration/components/MembershipJoinLeaveButton.js +++ b/src/collaboration/components/MembershipJoinLeaveButton.js @@ -49,6 +49,7 @@ const MembershipJoinLeaveButton = props => { [accountMembership] ); + // Component to cancel a pending membership request if ( is_member && accountMembership?.membershipStatus === MEMBERSHIP_STATUS_PENDING @@ -62,6 +63,8 @@ const MembershipJoinLeaveButton = props => { /> ); } + + // Component to leave a membership if the user is a member if (is_member) { return ( { /> ); } + + // Component to request to join a membership if the user is not a member + // and the membership_list is closed if (membershipsInfo?.membershipType === MEMBERSHIP_TYPE_CLOSED) { return ( { /> ); } + + // Component to join a membership if the user is not a member and + // the membership_list is open return ( { const query = graphql(` diff --git a/src/landscape/membership/components/LandscapeMembers.test.js b/src/landscape/membership/components/LandscapeMembers.test.js index f2454fa795..1d925facc7 100644 --- a/src/landscape/membership/components/LandscapeMembers.test.js +++ b/src/landscape/membership/components/LandscapeMembers.test.js @@ -119,12 +119,7 @@ test('LandscapeMembers: Display list', async () => { .mockReturnValueOnce( Promise.resolve(_.set('landscapes.edges[0].node', landscape, {})) ); - // .mockReturnValueOnce( - // Promise.resolve(_.set('groups.edges[0].node', group, {})) - // ) - // .mockReturnValueOnce( - // Promise.resolve(_.set('groups.edges[0].node', group, {})) - // ); + await setup(); // Landscape info