Skip to content

Commit

Permalink
fixed custom properties adding issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mathalav55 committed Nov 25, 2024
1 parent ca88675 commit b3b8d91
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions web/core/components/issues/issue-modal/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {

// store hooks
const { getProjectById } = useProject();
const { getIssueTypeIdOnProjectChange, getActiveAdditionalPropertiesLength, handlePropertyValuesValidation } =
const { getIssueTypeIdOnProjectChange, getActiveAdditionalPropertiesLength, handlePropertyValuesValidation, handleCreateUpdatePropertyValues } =
useIssueModal();
const { isMobile } = usePlatformOS();
const { moveIssue } = useWorkspaceDraftIssues();
Expand Down Expand Up @@ -236,6 +236,23 @@ export const IssueFormRoot: FC<IssueFormProps> = 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") !== "<p></p>");

Expand Down Expand Up @@ -493,14 +510,7 @@ export const IssueFormRoot: FC<IssueFormProps> = 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
</Button>
Expand Down

0 comments on commit b3b8d91

Please sign in to comment.