feat(webhooks): add created by user object when returning all webhooks

This commit is contained in:
kolaente 2023-10-18 20:06:07 +02:00
parent b4e3d8ee47
commit 72366a5b27
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 15 additions and 0 deletions

View File

@ -156,6 +156,21 @@ func (w *Webhook) ReadAll(s *xorm.Session, a web.Auth, _ string, page int, perPa
return
}
userIDs := []int64{}
for _, webhook := range ws {
userIDs = append(userIDs, webhook.CreatedByID)
}
users, err := user.GetUsersByIDs(s, userIDs)
if err != nil {
return nil, 0, 0, err
}
for _, webhook := range ws {
webhook.Secret = ""
webhook.CreatedBy = users[webhook.CreatedByID]
}
return ws, len(ws), total, err
}