tsk-328 Avoid issue relations backreferences (#2303)

Signed-off-by: Denis Bunakalya <denis.bunakalya@xored.com>
This commit is contained in:
Denis Bunakalya 2022-10-14 10:15:56 +03:00 committed by GitHub
parent 52e8fa405e
commit 71c3fce9e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View File

@ -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) {

View File

@ -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)