mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-31 04:38:02 +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) {
|
||||
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)
|
||||
}
|
||||
continue
|
||||
@ -459,7 +459,12 @@ export async function IssueToDoFactory (actualTx: TxCUD<Issue>, control: Trigger
|
||||
/**
|
||||
* @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[] = []
|
||||
let total = 0
|
||||
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> })
|
||||
)[0]
|
||||
if (issue !== undefined) {
|
||||
if (!isDerived) {
|
||||
const project = (await control.findAll(control.ctx, task.class.Project, { _id: issue.space }))[0]
|
||||
if (project !== undefined) {
|
||||
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) {
|
||||
// round to nearest 15 minutes
|
||||
|
@ -36,7 +36,7 @@ export interface ToDoFactory extends Class<Task> {
|
||||
* @public
|
||||
*/
|
||||
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: {
|
||||
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: {
|
||||
OnTask: '' as Resource<TriggerFunc>,
|
||||
|
Loading…
Reference in New Issue
Block a user