diff --git a/web/components/workspace/settings/members-list-item.tsx b/web/components/workspace/settings/members-list-item.tsx index b869d4d63..bd650c888 100644 --- a/web/components/workspace/settings/members-list-item.tsx +++ b/web/components/workspace/settings/members-list-item.tsx @@ -28,7 +28,8 @@ type Props = { display_name: string; role: TUserWorkspaceRole; status: boolean; - member: boolean; + is_member: boolean; + responded_at: string | null; accountCreated: boolean; }; }; @@ -102,9 +103,8 @@ export const WorkspaceMembersListItem: FC = observer((props) => { }; const handleRemove = async () => { - if (member.member) { + if (member.is_member) { const memberId = member.memberId; - if (memberId === currentUser?.id) await handleLeaveWorkspace(); else await handleRemoveMember(); } else await handleRemoveInvitation(); @@ -154,7 +154,7 @@ export const WorkspaceMembersListItem: FC = observer((props) => { )}
- {member.member ? ( + {member.is_member ? ( {member.first_name} {member.last_name} @@ -175,16 +175,21 @@ export const WorkspaceMembersListItem: FC = observer((props) => {
- {!member?.status && ( + {!member?.status && !member.responded_at && (

Pending

)} - {member?.status && !member?.accountCreated && ( + {member?.status && !member.is_member && (

Account not created

)} + {!member?.status && member.responded_at && ( +
+

Rejected

+
+ )} diff --git a/web/pages/workspace-invitations/index.tsx b/web/pages/workspace-invitations/index.tsx index 32cb61432..d374549aa 100644 --- a/web/pages/workspace-invitations/index.tsx +++ b/web/pages/workspace-invitations/index.tsx @@ -52,6 +52,19 @@ const WorkspaceInvitationPage: NextPageWithLayout = () => { .catch((err) => console.error(err)); }; + const handleReject = () => { + if (!invitationDetail) return; + workspaceService + .joinWorkspace(invitationDetail.workspace.slug, invitationDetail.id, { + accepted: false, + email: invitationDetail.email, + }) + .then(() => { + router.push("/"); + }) + .catch((err) => console.error(err)); + }; + return (
{invitationDetail ? ( @@ -77,13 +90,7 @@ const WorkspaceInvitationPage: NextPageWithLayout = () => { description="Your workspace is where you'll create projects, collaborate on your issues, and organize different streams of work in your Plane account." > - { - router.push("/"); - }} - /> + )} diff --git a/web/store/workspace/workspace-member.store.ts b/web/store/workspace/workspace-member.store.ts index e699cb467..dc6183245 100644 --- a/web/store/workspace/workspace-member.store.ts +++ b/web/store/workspace/workspace-member.store.ts @@ -114,8 +114,8 @@ export class WorkspaceMemberStore implements IWorkspaceMemberStore { display_name: item.email, role: item.role, status: item.accepted, - member: false, - accountCreated: item.accepted, + is_member: false, + responded_at: item.responded_at, })) || []), ...(this.workspaceMembers?.map((item) => ({ id: item.id, @@ -127,8 +127,8 @@ export class WorkspaceMemberStore implements IWorkspaceMemberStore { display_name: item.member?.display_name, role: item.role, status: true, - member: true, - accountCreated: true, + is_member: true, + responded_at: "accepted", })) || []), ]; }