1
0

fix(webhooks): make sure all events with tasks have the full task

Resolves https://kolaente.dev/vikunja/api/issues/1676
This commit is contained in:
kolaente
2024-01-27 00:16:17 +01:00
parent d38050f2b8
commit ae9b382963
5 changed files with 50 additions and 23 deletions

View File

@ -86,8 +86,13 @@ func (ta *TaskAttachment) NewAttachment(s *xorm.Session, f io.ReadCloser, realna
return err
}
task, err := GetTaskByIDSimple(s, ta.TaskID)
if err != nil {
return err
}
return events.Dispatch(&TaskAttachmentCreatedEvent{
Task: &Task{ID: ta.TaskID},
Task: &task,
Attachment: ta,
Doer: ta.CreatedBy,
})
@ -220,8 +225,13 @@ func (ta *TaskAttachment) Delete(s *xorm.Session, a web.Auth) error {
}
doer, _ := user.GetFromAuth(a)
task, err := GetTaskByIDSimple(s, ta.TaskID)
if err != nil {
return err
}
return events.Dispatch(&TaskAttachmentDeletedEvent{
Task: &Task{ID: ta.TaskID},
Task: &task,
Attachment: ta,
Doer: doer,
})