mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-12 20:57:45 +02:00
Fix remove project (#7941)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -36,7 +36,7 @@ import { getMetadata, IntlString } from '@hcengineering/platform'
|
||||
import serverCore, { TriggerControl } from '@hcengineering/server-core'
|
||||
import { NOTIFICATION_BODY_SIZE } from '@hcengineering/server-notification'
|
||||
import { stripTags } from '@hcengineering/text-core'
|
||||
import tracker, { Component, Issue, IssueParentInfo, TimeSpendReport, trackerId } from '@hcengineering/tracker'
|
||||
import tracker, { Component, Issue, IssueParentInfo, Project, TimeSpendReport, trackerId } from '@hcengineering/tracker'
|
||||
import { workbenchId } from '@hcengineering/workbench'
|
||||
|
||||
async function updateSubIssues (
|
||||
@@ -151,6 +151,28 @@ export async function getIssueNotificationContent (
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export async function OnProjectRemove (txes: Tx[], control: TriggerControl): Promise<Tx[]> {
|
||||
const result: Tx[] = []
|
||||
for (const tx of txes) {
|
||||
const ctx = tx as TxRemoveDoc<Project>
|
||||
const classes = [tracker.class.Issue, tracker.class.Component, tracker.class.Milestone, tracker.class.IssueTemplate]
|
||||
for (const cls of classes) {
|
||||
const docs = await control.findAll(control.ctx, cls, { space: ctx.objectId })
|
||||
for (const doc of docs) {
|
||||
const tx = control.txFactory.createTxRemoveDoc(cls, doc.space, doc._id)
|
||||
result.push(tx)
|
||||
}
|
||||
}
|
||||
}
|
||||
control.ctx.contextData.broadcast.targets.projectRemove = (it) => {
|
||||
return []
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
@@ -540,6 +562,7 @@ export default async () => ({
|
||||
},
|
||||
trigger: {
|
||||
OnIssueUpdate,
|
||||
OnProjectRemove,
|
||||
OnComponentRemove,
|
||||
OnWorkspaceOwnerAdded
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user