mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-22 16:27:22 +00:00
tsk-328 Avoid issue relations backreferences (#2303)
Signed-off-by: Denis Bunakalya <denis.bunakalya@xored.com>
This commit is contained in:
parent
52e8fa405e
commit
71c3fce9e7
@ -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) {
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user