From 0531dc3308edf9385f54b15c0f0b370b7bb549fc Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Tue, 23 Jan 2024 16:16:55 +0530 Subject: [PATCH] chore: fix authorization for new projects in the peek overview (#3439) * chore: fix authorization for new projects in the peek overview * fix: prjects empty state authorization * fix: peek overview auth --- web/components/issues/peek-overview/root.tsx | 2 +- web/components/project/card-list.tsx | 6 +++--- web/store/project/project.store.ts | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/web/components/issues/peek-overview/root.tsx b/web/components/issues/peek-overview/root.tsx index 5b36a1c4f..990efe55a 100644 --- a/web/components/issues/peek-overview/root.tsx +++ b/web/components/issues/peek-overview/root.tsx @@ -2,7 +2,7 @@ import { FC, Fragment, useEffect, useState, useMemo } from "react"; import { observer } from "mobx-react-lite"; // hooks import useToast from "hooks/use-toast"; -import { useIssueDetail, useIssues, useMember, useUser } from "hooks/store"; +import { useIssueDetail, useIssues, useUser } from "hooks/store"; // components import { IssueView } from "components/issues"; // types diff --git a/web/components/project/card-list.tsx b/web/components/project/card-list.tsx index 1b9903b16..488fe5673 100644 --- a/web/components/project/card-list.tsx +++ b/web/components/project/card-list.tsx @@ -9,7 +9,7 @@ import emptyProject from "public/empty-state/empty_project.webp"; // icons import { NewEmptyState } from "components/common/new-empty-state"; // constants -import { EUserProjectRoles } from "constants/project"; +import { EUserWorkspaceRoles } from "constants/workspace"; export const ProjectCardList = observer(() => { // store hooks @@ -18,11 +18,11 @@ export const ProjectCardList = observer(() => { eventTracker: { setTrackElement }, } = useApplication(); const { - membership: { currentProjectRole }, + membership: { currentWorkspaceRole }, } = useUser(); const { workspaceProjectIds, searchedProjects, getProjectById } = useProject(); - const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER; + const isEditingAllowed = !!currentWorkspaceRole && currentWorkspaceRole >= EUserWorkspaceRoles.MEMBER; if (!workspaceProjectIds) return ( diff --git a/web/store/project/project.store.ts b/web/store/project/project.store.ts index ffdd27fc1..ef88c5b0f 100644 --- a/web/store/project/project.store.ts +++ b/web/store/project/project.store.ts @@ -317,6 +317,7 @@ export class ProjectStore implements IProjectStore { const response = await this.projectService.createProject(workspaceSlug, data); runInAction(() => { set(this.projectMap, [response.id], response); + set(this.rootStore.user.membership.workspaceProjectsRole, [workspaceSlug, response.id], response.member_role); }); return response; } catch (error) {