mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 11:42:30 +03:00
Fix todo creating on assignee change (#5435)
This commit is contained in:
parent
703960d4ee
commit
77e0b4526b
@ -501,9 +501,21 @@ async function changeIssueAssigneeHandler (
|
||||
if (issue !== undefined) {
|
||||
const status = (await control.findAll(core.class.Status, { _id: issue.status }))[0]
|
||||
if (status === undefined) return []
|
||||
if (status.category === task.statusCategory.Active) {
|
||||
if (status.category === task.statusCategory.Active || status.category === task.statusCategory.ToDo) {
|
||||
const res: Tx[] = []
|
||||
const todos = await control.findAll(time.class.ToDo, {
|
||||
attachedTo: issue._id
|
||||
})
|
||||
const now = Date.now()
|
||||
for (const todo of todos) {
|
||||
if (todo.doneOn != null) continue
|
||||
res.push(control.txFactory.createTxUpdateDoc(todo._class, todo.space, todo._id, { doneOn: now }))
|
||||
}
|
||||
const tx = await getCreateToDoTx(issue, newAssignee, control)
|
||||
if (tx !== undefined) return [tx]
|
||||
if (tx !== undefined) {
|
||||
res.push(tx)
|
||||
}
|
||||
return res
|
||||
}
|
||||
}
|
||||
return []
|
||||
|
Loading…
Reference in New Issue
Block a user