forked from github/plane
fix: workspace invitations response updated (#3321)
This commit is contained in:
parent
efd3ebf067
commit
0a05aef046
10
packages/types/src/workspace.d.ts
vendored
10
packages/types/src/workspace.d.ts
vendored
@ -1,5 +1,10 @@
|
|||||||
import { EUserWorkspaceRoles } from "constants/workspace";
|
import { EUserWorkspaceRoles } from "constants/workspace";
|
||||||
import type { IProjectMember, IUser, IUserLite, IWorkspaceViewProps } from "@plane/types";
|
import type {
|
||||||
|
IProjectMember,
|
||||||
|
IUser,
|
||||||
|
IUserLite,
|
||||||
|
IWorkspaceViewProps,
|
||||||
|
} from "@plane/types";
|
||||||
|
|
||||||
export interface IWorkspace {
|
export interface IWorkspace {
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
@ -32,8 +37,7 @@ export interface IWorkspaceMemberInvitation {
|
|||||||
responded_at: Date;
|
responded_at: Date;
|
||||||
role: EUserWorkspaceRoles;
|
role: EUserWorkspaceRoles;
|
||||||
token: string;
|
token: string;
|
||||||
workspace: string;
|
workspace: {
|
||||||
workspace_detail: {
|
|
||||||
id: string;
|
id: string;
|
||||||
logo: string;
|
logo: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -86,7 +86,7 @@ export const Invitations: React.FC<Props> = (props) => {
|
|||||||
invitations.length > 0 &&
|
invitations.length > 0 &&
|
||||||
invitations.map((invitation) => {
|
invitations.map((invitation) => {
|
||||||
const isSelected = invitationsRespond.includes(invitation.id);
|
const isSelected = invitationsRespond.includes(invitation.id);
|
||||||
const invitedWorkspace = workspaces[invitation.workspace];
|
const invitedWorkspace = workspaces[invitation.workspace.id];
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={invitation.id}
|
key={invitation.id}
|
||||||
|
@ -83,7 +83,7 @@ const UserInvitationsPage: NextPageWithLayout = observer(() => {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
mutate("USER_WORKSPACES");
|
mutate("USER_WORKSPACES");
|
||||||
const firstInviteId = invitationsRespond[0];
|
const firstInviteId = invitationsRespond[0];
|
||||||
const redirectWorkspace = invitations?.find((i) => i.id === firstInviteId)?.workspace_detail;
|
const redirectWorkspace = invitations?.find((i) => i.id === firstInviteId)?.workspace;
|
||||||
postHogEventTracker("MEMBER_ACCEPTED", {
|
postHogEventTracker("MEMBER_ACCEPTED", {
|
||||||
...res,
|
...res,
|
||||||
state: "SUCCESS",
|
state: "SUCCESS",
|
||||||
@ -153,23 +153,23 @@ const UserInvitationsPage: NextPageWithLayout = observer(() => {
|
|||||||
>
|
>
|
||||||
<div className="flex-shrink-0">
|
<div className="flex-shrink-0">
|
||||||
<div className="grid h-9 w-9 place-items-center rounded">
|
<div className="grid h-9 w-9 place-items-center rounded">
|
||||||
{invitation.workspace_detail.logo && invitation.workspace_detail.logo.trim() !== "" ? (
|
{invitation.workspace.logo && invitation.workspace.logo.trim() !== "" ? (
|
||||||
<img
|
<img
|
||||||
src={invitation.workspace_detail.logo}
|
src={invitation.workspace.logo}
|
||||||
height="100%"
|
height="100%"
|
||||||
width="100%"
|
width="100%"
|
||||||
className="rounded"
|
className="rounded"
|
||||||
alt={invitation.workspace_detail.name}
|
alt={invitation.workspace.name}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<span className="grid h-9 w-9 place-items-center rounded bg-gray-700 px-3 py-1.5 uppercase text-white">
|
<span className="grid h-9 w-9 place-items-center rounded bg-gray-700 px-3 py-1.5 uppercase text-white">
|
||||||
{invitation.workspace_detail.name[0]}
|
{invitation.workspace.name[0]}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<div className="text-sm font-medium">{truncateText(invitation.workspace_detail.name, 30)}</div>
|
<div className="text-sm font-medium">{truncateText(invitation.workspace.name, 30)}</div>
|
||||||
<p className="text-xs text-custom-text-200">{ROLE[invitation.role]}</p>
|
<p className="text-xs text-custom-text-200">{ROLE[invitation.role]}</p>
|
||||||
</div>
|
</div>
|
||||||
<span
|
<span
|
||||||
|
@ -38,7 +38,7 @@ const WorkspaceInvitationPage: NextPageWithLayout = observer(() => {
|
|||||||
const handleAccept = () => {
|
const handleAccept = () => {
|
||||||
if (!invitationDetail) return;
|
if (!invitationDetail) return;
|
||||||
workspaceService
|
workspaceService
|
||||||
.joinWorkspace(invitationDetail.workspace_detail.slug, invitationDetail.id, {
|
.joinWorkspace(invitationDetail.workspace.slug, invitationDetail.id, {
|
||||||
accepted: true,
|
accepted: true,
|
||||||
email: invitationDetail.email,
|
email: invitationDetail.email,
|
||||||
})
|
})
|
||||||
@ -55,7 +55,7 @@ const WorkspaceInvitationPage: NextPageWithLayout = observer(() => {
|
|||||||
const handleReject = () => {
|
const handleReject = () => {
|
||||||
if (!invitationDetail) return;
|
if (!invitationDetail) return;
|
||||||
workspaceService
|
workspaceService
|
||||||
.joinWorkspace(invitationDetail.workspace_detail.slug, invitationDetail.id, {
|
.joinWorkspace(invitationDetail.workspace.slug, invitationDetail.id, {
|
||||||
accepted: false,
|
accepted: false,
|
||||||
email: invitationDetail.email,
|
email: invitationDetail.email,
|
||||||
})
|
})
|
||||||
@ -78,7 +78,7 @@ const WorkspaceInvitationPage: NextPageWithLayout = observer(() => {
|
|||||||
{invitationDetail.accepted ? (
|
{invitationDetail.accepted ? (
|
||||||
<>
|
<>
|
||||||
<EmptySpace
|
<EmptySpace
|
||||||
title={`You are already a member of ${invitationDetail.workspace_detail.name}`}
|
title={`You are already a member of ${invitationDetail.workspace.name}`}
|
||||||
description="Your workspace is where you'll create projects, collaborate on your issues, and organize different streams of work in your Plane account."
|
description="Your workspace is where you'll create projects, collaborate on your issues, and organize different streams of work in your Plane account."
|
||||||
>
|
>
|
||||||
<EmptySpaceItem Icon={Boxes} title="Continue to Dashboard" action={() => router.push("/")} />
|
<EmptySpaceItem Icon={Boxes} title="Continue to Dashboard" action={() => router.push("/")} />
|
||||||
@ -86,7 +86,7 @@ const WorkspaceInvitationPage: NextPageWithLayout = observer(() => {
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<EmptySpace
|
<EmptySpace
|
||||||
title={`You have been invited to ${invitationDetail.workspace_detail.name}`}
|
title={`You have been invited to ${invitationDetail.workspace.name}`}
|
||||||
description="Your workspace is where you'll create projects, collaborate on your issues, and organize different streams of work in your Plane account."
|
description="Your workspace is where you'll create projects, collaborate on your issues, and organize different streams of work in your Plane account."
|
||||||
>
|
>
|
||||||
<EmptySpaceItem Icon={Check} title="Accept" action={handleAccept} />
|
<EmptySpaceItem Icon={Check} title="Accept" action={handleAccept} />
|
||||||
|
Loading…
Reference in New Issue
Block a user