From 6c8c61c53b75df74d22b4306ead24e421c446008 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Fri, 8 Dec 2023 15:56:05 +0530 Subject: [PATCH] bug: cycle and module change not working from the peek overview (#3037) --- .../issues/peek-overview/properties.tsx | 34 +++++++++++-------- .../project-issues/cycle/issue.store.ts | 12 +++---- .../project-issues/module/issue.store.ts | 8 ++--- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/web/components/issues/peek-overview/properties.tsx b/web/components/issues/peek-overview/properties.tsx index 5132aaa8a..ce08e7e4d 100644 --- a/web/components/issues/peek-overview/properties.tsx +++ b/web/components/issues/peek-overview/properties.tsx @@ -48,10 +48,11 @@ export const PeekOverviewProperties: FC = observer((pro const { user: { currentProjectRole }, issueDetail: { fetchPeekIssueDetails }, + project: { getProjectById }, } = useMobxStore(); const router = useRouter(); - const { workspaceSlug, projectId } = router.query as { workspaceSlug: string; projectId: string }; + const { workspaceSlug, projectId } = router.query; const { setToastAlert } = useToast(); @@ -138,7 +139,7 @@ export const PeekOverviewProperties: FC = observer((pro const handleCycleOrModuleChange = async () => { if (!workspaceSlug || !projectId) return; - await fetchPeekIssueDetails(workspaceSlug, projectId, issue.id); + await fetchPeekIssueDetails(workspaceSlug.toString(), projectId.toString(), issue.id); }; const handleEditLink = (link: ILinkDetails) => { @@ -167,6 +168,9 @@ export const PeekOverviewProperties: FC = observer((pro }); }; + const projectDetails = workspaceSlug ? getProjectById(workspaceSlug.toString(), issue.project) : null; + const isEstimateEnabled = projectDetails?.estimate; + const minDate = issue.start_date ? new Date(issue.start_date) : null; minDate?.setDate(minDate.getDate()); @@ -230,19 +234,21 @@ export const PeekOverviewProperties: FC = observer((pro {/* estimate */} -
-
- -

Estimate

+ {isEstimateEnabled && ( +
+
+ +

Estimate

+
+
+ +
-
- -
-
+ )} {/* start date */}
diff --git a/web/store/issues/project-issues/cycle/issue.store.ts b/web/store/issues/project-issues/cycle/issue.store.ts index ffcf850b8..ed1bdcfeb 100644 --- a/web/store/issues/project-issues/cycle/issue.store.ts +++ b/web/store/issues/project-issues/cycle/issue.store.ts @@ -5,7 +5,7 @@ import { IssueBaseStore } from "store/issues"; import { IssueService } from "services/issue"; import { CycleService } from "services/cycle.service"; // types -import { CycleIssueResponse, TIssueGroupByOptions } from "types"; +import { TIssueGroupByOptions } from "types"; import { IIssue } from "types/issues"; import { IIssueResponse, TLoader, IGroupedIssues, ISubGroupedIssues, TUnGroupedIssues, ViewFlags } from "../../types"; import { RootStore } from "store/root"; @@ -83,9 +83,6 @@ export class CycleIssuesStore extends IssueBaseStore implements ICycleIssuesStor cycleService; issueService; - //projectId - currentProjectId: string | undefined; - //viewData viewFlags = { enableQuickAdd: true, @@ -174,8 +171,6 @@ export class CycleIssuesStore extends IssueBaseStore implements ICycleIssuesStor try { this.loader = loadType; - this.currentProjectId = projectId; - const params = this.rootStore?.cycleIssuesFilter?.appliedFilters; const response = await this.cycleService.getCycleIssuesWithParams(workspaceSlug, projectId, cycleId, params); @@ -322,9 +317,10 @@ export class CycleIssuesStore extends IssueBaseStore implements ICycleIssuesStor fetchAfterAddition = true, projectId?: string ) => { - if (!this.currentProjectId && !projectId) return; + const activeProjectId = this.rootStore.project.projectId; + if (!activeProjectId && !projectId) return; - const projectIdToUpdate: string = this.currentProjectId || projectId || ""; + const projectIdToUpdate: string = projectId || activeProjectId || ""; try { const issueToCycle = await this.issueService.addIssueToCycle(workspaceSlug, projectIdToUpdate, cycleId, { diff --git a/web/store/issues/project-issues/module/issue.store.ts b/web/store/issues/project-issues/module/issue.store.ts index 89a678422..1f1d1c190 100644 --- a/web/store/issues/project-issues/module/issue.store.ts +++ b/web/store/issues/project-issues/module/issue.store.ts @@ -76,8 +76,6 @@ export class ModuleIssuesStore extends IssueBaseStore implements IModuleIssuesSt moduleService; issueService; - currentProjectId: string | undefined; - //viewData viewFlags = { enableQuickAdd: true, @@ -162,7 +160,6 @@ export class ModuleIssuesStore extends IssueBaseStore implements IModuleIssuesSt ) => { if (!moduleId) return undefined; - this.currentProjectId = projectId; try { this.loader = loadType; @@ -314,9 +311,10 @@ export class ModuleIssuesStore extends IssueBaseStore implements IModuleIssuesSt fetchAfterAddition = true, projectId?: string ) => { - if (!this.currentProjectId && !projectId) return; + const activeProjectId = this.rootStore.project.projectId; + if (!activeProjectId && !projectId) return; - const projectIdToUpdate: string = this.currentProjectId || projectId || ""; + const projectIdToUpdate: string = projectId || activeProjectId || ""; try { const issueToModule = await this.moduleService.addIssuesToModule(workspaceSlug, projectIdToUpdate, moduleId, {