Skip to content

Commit

Permalink
fix: Added membership button comments, changed to absolute import pat…
Browse files Browse the repository at this point in the history
…hs, removed commeted code
  • Loading branch information
josebui committed Nov 23, 2023
1 parent dd9672b commit 179135a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
9 changes: 9 additions & 0 deletions src/collaboration/components/MembershipJoinLeaveButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const MembershipJoinLeaveButton = props => {
[accountMembership]
);

// Component to cancel a pending membership request
if (
is_member &&
accountMembership?.membershipStatus === MEMBERSHIP_STATUS_PENDING
Expand All @@ -62,6 +63,8 @@ const MembershipJoinLeaveButton = props => {
/>
);
}

// Component to leave a membership if the user is a member
if (is_member) {
return (
<MemberLeaveButton
Expand All @@ -72,6 +75,9 @@ const MembershipJoinLeaveButton = props => {
/>
);
}

// 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 (
<MemberRequestJoinButton
Expand All @@ -81,6 +87,9 @@ const MembershipJoinLeaveButton = props => {
/>
);
}

// Component to join a membership if the user is not a member and
// the membership_list is open
return (
<MemberJoinButton
onJoin={onMemberJoinWrapper}
Expand Down
6 changes: 3 additions & 3 deletions src/group/groupService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import {
import * as terrasoApi from 'terraso-client-shared/terrasoApi/api';
import { graphql } from 'terrasoApi/shared/graphqlSchema';

import type { Group } from './groupSlice';
import { extractGroup } from './groupUtils';
import { ROLE_MEMBER } from './membership/components/groupMembershipConstants';
import type { Group } from 'group/groupSlice';
import { extractGroup } from 'group/groupUtils';
import { ROLE_MEMBER } from 'group/membership/components/groupMembershipConstants';

export const fetchGroupToUpdate = (slug: string) => {
const query = graphql(`
Expand Down
7 changes: 1 addition & 6 deletions src/landscape/membership/components/LandscapeMembers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 179135a

Please sign in to comment.