From 24bb34f2bed854aa580a6b3d10f03a029248719b Mon Sep 17 00:00:00 2001 From: Vamsi krishna Date: Mon, 23 Dec 2024 20:47:47 +0530 Subject: [PATCH] fix: enabling guest user to edit his own views --- .../[projectId]/views/(detail)/[viewId]/header.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(detail)/[viewId]/header.tsx b/web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(detail)/[viewId]/header.tsx index aca4b5b4a5e..0971a263a89 100644 --- a/web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(detail)/[viewId]/header.tsx +++ b/web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(detail)/[viewId]/header.tsx @@ -31,6 +31,7 @@ import { useProject, useProjectState, useProjectView, + useUser, useUserPermissions, } from "@/hooks/store"; import { EUserPermissions, EUserPermissionsLevel } from "@/plane-web/constants/user-permissions"; @@ -45,6 +46,7 @@ export const ProjectViewIssuesHeader: React.FC = observer(() => { const { setTrackElement } = useEventTracker(); const { toggleCreateIssueModal } = useCommandPalette(); const { allowPermissions } = useUserPermissions(); + const { data } = useUser(); const { currentProjectDetails, loader } = useProject(); const { projectViewIds, getViewById } = useProjectView(); @@ -127,6 +129,10 @@ export const ProjectViewIssuesHeader: React.FC = observer(() => { const viewDetails = viewId ? getViewById(viewId.toString()) : null; + // auth + const isOwner = viewDetails?.owned_by === data?.id; + const isAdmin = allowPermissions([EUserPermissions.ADMIN], EUserPermissionsLevel.PROJECT); + const canUserCreateIssue = allowPermissions( [EUserPermissions.ADMIN, EUserPermissions.MEMBER], EUserPermissionsLevel.PROJECT @@ -247,7 +253,7 @@ export const ProjectViewIssuesHeader: React.FC = observer(() => {