mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 16:56:07 +00:00
fix change issue status when change assignee (#7438)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
59b1635afb
commit
51a55dd803
@ -405,7 +405,7 @@ export async function OnToDoUpdate (txes: Tx[], control: TriggerControl): Promis
|
|||||||
)
|
)
|
||||||
if (funcs !== undefined) {
|
if (funcs !== undefined) {
|
||||||
const func = await getResource(funcs.onDone)
|
const func = await getResource(funcs.onDone)
|
||||||
const todoRes = await func(control, resEvents, todo)
|
const todoRes = await func(control, resEvents, todo, tx.space === core.space.DerivedTx)
|
||||||
await control.apply(control.ctx, todoRes)
|
await control.apply(control.ctx, todoRes)
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
@ -459,7 +459,12 @@ export async function IssueToDoFactory (actualTx: TxCUD<Issue>, control: Trigger
|
|||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export async function IssueToDoDone (control: TriggerControl, workslots: WorkSlot[], todo: ToDo): Promise<Tx[]> {
|
export async function IssueToDoDone (
|
||||||
|
control: TriggerControl,
|
||||||
|
workslots: WorkSlot[],
|
||||||
|
todo: ToDo,
|
||||||
|
isDerived: boolean
|
||||||
|
): Promise<Tx[]> {
|
||||||
const res: Tx[] = []
|
const res: Tx[] = []
|
||||||
let total = 0
|
let total = 0
|
||||||
for (const workslot of workslots) {
|
for (const workslot of workslots) {
|
||||||
@ -470,6 +475,7 @@ export async function IssueToDoDone (control: TriggerControl, workslots: WorkSlo
|
|||||||
await control.findAll<Issue>(control.ctx, todo.attachedToClass, { _id: todo.attachedTo as Ref<Issue> })
|
await control.findAll<Issue>(control.ctx, todo.attachedToClass, { _id: todo.attachedTo as Ref<Issue> })
|
||||||
)[0]
|
)[0]
|
||||||
if (issue !== undefined) {
|
if (issue !== undefined) {
|
||||||
|
if (!isDerived) {
|
||||||
const project = (await control.findAll(control.ctx, task.class.Project, { _id: issue.space }))[0]
|
const project = (await control.findAll(control.ctx, task.class.Project, { _id: issue.space }))[0]
|
||||||
if (project !== undefined) {
|
if (project !== undefined) {
|
||||||
const type = (await control.modelDb.findAll(task.class.ProjectType, { _id: project.type }))[0]
|
const type = (await control.modelDb.findAll(task.class.ProjectType, { _id: project.type }))[0]
|
||||||
@ -515,6 +521,7 @@ export async function IssueToDoDone (control: TriggerControl, workslots: WorkSlo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (total > 0) {
|
if (total > 0) {
|
||||||
// round to nearest 15 minutes
|
// round to nearest 15 minutes
|
||||||
|
@ -36,7 +36,7 @@ export interface ToDoFactory extends Class<Task> {
|
|||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export interface OnToDo extends Class<Doc> {
|
export interface OnToDo extends Class<Doc> {
|
||||||
onDone: Resource<(control: TriggerControl, workslots: WorkSlot[], todo: ToDo) => Promise<Tx[]>>
|
onDone: Resource<(control: TriggerControl, workslots: WorkSlot[], todo: ToDo, isDerived: boolean) => Promise<Tx[]>>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,7 +49,9 @@ export default plugin(serverTimeId, {
|
|||||||
},
|
},
|
||||||
function: {
|
function: {
|
||||||
IssueToDoFactory: '' as Resource<(tx: Tx, control: TriggerControl) => Promise<Tx[]>>,
|
IssueToDoFactory: '' as Resource<(tx: Tx, control: TriggerControl) => Promise<Tx[]>>,
|
||||||
IssueToDoDone: '' as Resource<(control: TriggerControl, workslots: WorkSlot[], todo: ToDo) => Promise<Tx[]>>
|
IssueToDoDone: '' as Resource<
|
||||||
|
(control: TriggerControl, workslots: WorkSlot[], todo: ToDo, isDerived: boolean) => Promise<Tx[]>
|
||||||
|
>
|
||||||
},
|
},
|
||||||
trigger: {
|
trigger: {
|
||||||
OnTask: '' as Resource<TriggerFunc>,
|
OnTask: '' as Resource<TriggerFunc>,
|
||||||
|
Loading…
Reference in New Issue
Block a user