feat: always add project to webhook payload

Resolves https://github.com/go-vikunja/vikunja/issues/410
This commit is contained in:
kolaente 2025-02-21 19:45:07 +01:00
parent 398d0c7ab5
commit 70e1fdae91
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B
1 changed files with 12 additions and 0 deletions

View File

@ -962,6 +962,18 @@ func (wl *WebhookListener) Handle(msg *message.Message) (err error) {
}
for _, webhook := range matchingWebhooks {
if _, has := event["project"]; !has {
project := &Project{ID: webhook.ProjectID}
err = project.ReadOne(s, &user.User{ID: doerID})
if err != nil && !IsErrProjectDoesNotExist(err) {
return err
}
if err == nil {
event["project"] = project
}
}
err = webhook.sendWebhookPayload(&WebhookPayload{
EventName: wl.EventName,
Time: time.Now(),