diff --git a/plugins/tracker-resources/src/components/CreateIssue.svelte b/plugins/tracker-resources/src/components/CreateIssue.svelte index 3e25f014bb..ed61953e3f 100644 --- a/plugins/tracker-resources/src/components/CreateIssue.svelte +++ b/plugins/tracker-resources/src/components/CreateIssue.svelte @@ -47,7 +47,7 @@ import view from '@hcengineering/view' import { ObjectBox } from '@hcengineering/view-resources' import { createEventDispatcher } from 'svelte' - import { activeProject, activeSprint } from '../issues' + import { activeProject, activeSprint, updateIssueRelation } from '../issues' import tracker from '../plugin' import AssigneeEditor from './issues/AssigneeEditor.svelte' import ParentIssue from './issues/ParentIssue.svelte' @@ -318,11 +318,15 @@ } await descriptionBox.createAttachments() - const update = await getResource(chunter.backreference.Update) if (relatedTo !== undefined) { const doc = await client.findOne(tracker.class.Issue, { _id: objectId }) if (doc !== undefined) { - await update(doc, 'relations', [relatedTo], tracker.string.AddedReference) + if (client.getHierarchy().isDerived(relatedTo._class, tracker.class.Issue)) { + await updateIssueRelation(client, relatedTo as Issue, doc, 'relations', '$push') + } else { + const update = await getResource(chunter.backreference.Update) + await update(doc, 'relations', [relatedTo], tracker.string.AddedReference) + } } } for (const subIssue of subIssues) { diff --git a/plugins/tracker-resources/src/components/RelationsPopup.svelte b/plugins/tracker-resources/src/components/RelationsPopup.svelte index e559f8354a..a114395e4d 100644 --- a/plugins/tracker-resources/src/components/RelationsPopup.svelte +++ b/plugins/tracker-resources/src/components/RelationsPopup.svelte @@ -36,8 +36,12 @@ if (type !== 'isBlocking') { await updateIssueRelation(client, value, refDocument, prop, operation) } - if (type !== 'blockedBy' && client.getHierarchy().isDerived(refDocument._class, tracker.class.Issue)) { - await updateIssueRelation(client, refDocument as unknown as Issue, value, prop, operation) + if (client.getHierarchy().isDerived(refDocument._class, tracker.class.Issue)) { + if (type !== 'blockedBy') { + await updateIssueRelation(client, refDocument as Issue, value, prop, operation) + } + + return } const update = await getResource(chunter.backreference.Update)