From b3b8d916b6b94b70cd1316686d5392bfdbc875b6 Mon Sep 17 00:00:00 2001 From: vamsi krishna Date: Mon, 25 Nov 2024 18:10:32 +0530 Subject: [PATCH] fixed custom properties adding issue --- .../components/issues/issue-modal/form.tsx | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/web/core/components/issues/issue-modal/form.tsx b/web/core/components/issues/issue-modal/form.tsx index 221f6627a67..6f1cee6b6fd 100644 --- a/web/core/components/issues/issue-modal/form.tsx +++ b/web/core/components/issues/issue-modal/form.tsx @@ -113,7 +113,7 @@ export const IssueFormRoot: FC = observer((props) => { // store hooks const { getProjectById } = useProject(); - const { getIssueTypeIdOnProjectChange, getActiveAdditionalPropertiesLength, handlePropertyValuesValidation } = + const { getIssueTypeIdOnProjectChange, getActiveAdditionalPropertiesLength, handlePropertyValuesValidation, handleCreateUpdatePropertyValues } = useIssueModal(); const { isMobile } = usePlatformOS(); const { moveIssue } = useWorkspaceDraftIssues(); @@ -236,6 +236,23 @@ export const IssueFormRoot: FC = observer((props) => { }); }; + const handleMoveToProjects = async () => { + if( !data?.id ||!data?.project_id || !data) return + await handleCreateUpdatePropertyValues({ + issueId: data.id, + issueTypeId: data.type_id, + projectId: data.project_id, + workspaceSlug: workspaceSlug.toString(), + isDraft: true + }) + + moveIssue(workspaceSlug.toString(), data.id, { + ...data, + ...getValues(), + } as TWorkspaceDraftIssue); + + } + const condition = (watch("name") && watch("name") !== "") || (watch("description_html") && watch("description_html") !== "

"); @@ -493,14 +510,7 @@ export const IssueFormRoot: FC = observer((props) => { type="button" size="sm" loading={isSubmitting} - onClick={() => { - if (data?.id && data) { - moveIssue(workspaceSlug.toString(), data?.id, { - ...data, - ...getValues(), - } as TWorkspaceDraftIssue); - } - }} + onClick={handleMoveToProjects} > Add to project