forked from github/plane
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
This commit is contained in:
parent
e36b7a5ab9
commit
0531dc3308
@ -2,7 +2,7 @@ import { FC, Fragment, useEffect, useState, useMemo } from "react";
|
|||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
// hooks
|
// hooks
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
import { useIssueDetail, useIssues, useMember, useUser } from "hooks/store";
|
import { useIssueDetail, useIssues, useUser } from "hooks/store";
|
||||||
// components
|
// components
|
||||||
import { IssueView } from "components/issues";
|
import { IssueView } from "components/issues";
|
||||||
// types
|
// types
|
||||||
|
@ -9,7 +9,7 @@ import emptyProject from "public/empty-state/empty_project.webp";
|
|||||||
// icons
|
// icons
|
||||||
import { NewEmptyState } from "components/common/new-empty-state";
|
import { NewEmptyState } from "components/common/new-empty-state";
|
||||||
// constants
|
// constants
|
||||||
import { EUserProjectRoles } from "constants/project";
|
import { EUserWorkspaceRoles } from "constants/workspace";
|
||||||
|
|
||||||
export const ProjectCardList = observer(() => {
|
export const ProjectCardList = observer(() => {
|
||||||
// store hooks
|
// store hooks
|
||||||
@ -18,11 +18,11 @@ export const ProjectCardList = observer(() => {
|
|||||||
eventTracker: { setTrackElement },
|
eventTracker: { setTrackElement },
|
||||||
} = useApplication();
|
} = useApplication();
|
||||||
const {
|
const {
|
||||||
membership: { currentProjectRole },
|
membership: { currentWorkspaceRole },
|
||||||
} = useUser();
|
} = useUser();
|
||||||
const { workspaceProjectIds, searchedProjects, getProjectById } = useProject();
|
const { workspaceProjectIds, searchedProjects, getProjectById } = useProject();
|
||||||
|
|
||||||
const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER;
|
const isEditingAllowed = !!currentWorkspaceRole && currentWorkspaceRole >= EUserWorkspaceRoles.MEMBER;
|
||||||
|
|
||||||
if (!workspaceProjectIds)
|
if (!workspaceProjectIds)
|
||||||
return (
|
return (
|
||||||
|
@ -317,6 +317,7 @@ export class ProjectStore implements IProjectStore {
|
|||||||
const response = await this.projectService.createProject(workspaceSlug, data);
|
const response = await this.projectService.createProject(workspaceSlug, data);
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
set(this.projectMap, [response.id], response);
|
set(this.projectMap, [response.id], response);
|
||||||
|
set(this.rootStore.user.membership.workspaceProjectsRole, [workspaceSlug, response.id], response.member_role);
|
||||||
});
|
});
|
||||||
return response;
|
return response;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user