[WEB-2682] fix: delete project mutation and workspace draft header validation (#5843)
* fix: workspace draft header action validation * fix: delete project mutation
This commit is contained in:
parent
9b85306359
commit
7d36d63eb1
2 changed files with 16 additions and 12 deletions
|
|
@ -1,6 +1,6 @@
|
|||
"use client";
|
||||
|
||||
import { FC, useState } from "react";
|
||||
import { useState } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { PenSquare } from "lucide-react";
|
||||
// ui
|
||||
|
|
@ -11,16 +11,17 @@ import { CreateUpdateIssueModal } from "@/components/issues";
|
|||
// constants
|
||||
import { EIssuesStoreType } from "@/constants/issue";
|
||||
// hooks
|
||||
import { useUserPermissions, useWorkspaceDraftIssues } from "@/hooks/store";
|
||||
import { useProject, useUserPermissions, useWorkspaceDraftIssues } from "@/hooks/store";
|
||||
// plane-web
|
||||
import { EUserPermissions, EUserPermissionsLevel } from "@/plane-web/constants/user-permissions";
|
||||
|
||||
export const WorkspaceDraftHeader: FC = observer(() => {
|
||||
export const WorkspaceDraftHeader = observer(() => {
|
||||
// state
|
||||
const [isDraftIssueModalOpen, setIsDraftIssueModalOpen] = useState(false);
|
||||
// store hooks
|
||||
const { allowPermissions } = useUserPermissions();
|
||||
const { paginationInfo } = useWorkspaceDraftIssues();
|
||||
const { joinedProjectIds } = useProject();
|
||||
// check if user is authorized to create draft issue
|
||||
const isAuthorizedUser = allowPermissions(
|
||||
[EUserPermissions.ADMIN, EUserPermissions.MEMBER],
|
||||
|
|
@ -53,6 +54,7 @@ export const WorkspaceDraftHeader: FC = observer(() => {
|
|||
</Header.LeftItem>
|
||||
|
||||
<Header.RightItem>
|
||||
{joinedProjectIds && joinedProjectIds.length > 0 && (
|
||||
<Button
|
||||
variant="primary"
|
||||
size="sm"
|
||||
|
|
@ -62,6 +64,7 @@ export const WorkspaceDraftHeader: FC = observer(() => {
|
|||
>
|
||||
Draft<span className="hidden sm:inline-block"> an issue</span>
|
||||
</Button>
|
||||
)}
|
||||
</Header.RightItem>
|
||||
</Header>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -404,6 +404,7 @@ export class ProjectStore implements IProjectStore {
|
|||
runInAction(() => {
|
||||
delete this.projectMap[projectId];
|
||||
if (this.rootStore.favorite.entityMap[projectId]) this.rootStore.favorite.removeFavoriteFromStore(projectId);
|
||||
delete this.rootStore.user.permission.workspaceProjectsPermissions[workspaceSlug][projectId];
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("Failed to delete project from project store");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue