diff options
author | JakobDev <jakobdev@gmx.de> | 2023-10-14 10:37:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-14 08:37:24 +0000 |
commit | 76a85a4ce90fead1eb2b743a42b41617b4592889 (patch) | |
tree | ef172bbbc48c24e0d95cd5c689426bad16205a69 /routers/api/v1/utils | |
parent | ae419fa49403537725c806a5f3f1e5b274f52eb7 (diff) | |
download | gitea-76a85a4ce90fead1eb2b743a42b41617b4592889.tar.gz gitea-76a85a4ce90fead1eb2b743a42b41617b4592889.zip |
Final round of `db.DefaultContext` refactor (#27587)
Last part of #27065
Diffstat (limited to 'routers/api/v1/utils')
-rw-r--r-- | routers/api/v1/utils/hook.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/routers/api/v1/utils/hook.go b/routers/api/v1/utils/hook.go index b62d20a18a..362f4bfc4d 100644 --- a/routers/api/v1/utils/hook.go +++ b/routers/api/v1/utils/hook.go @@ -26,7 +26,7 @@ func ListOwnerHooks(ctx *context.APIContext, owner *user_model.User) { OwnerID: owner.ID, } - count, err := webhook.CountWebhooksByOpts(opts) + count, err := webhook.CountWebhooksByOpts(ctx, opts) if err != nil { ctx.InternalServerError(err) return @@ -53,7 +53,7 @@ func ListOwnerHooks(ctx *context.APIContext, owner *user_model.User) { // GetOwnerHook gets an user or organization webhook. Errors are written to ctx. func GetOwnerHook(ctx *context.APIContext, ownerID, hookID int64) (*webhook.Webhook, error) { - w, err := webhook.GetWebhookByOwnerID(ownerID, hookID) + w, err := webhook.GetWebhookByOwnerID(ctx, ownerID, hookID) if err != nil { if webhook.IsErrWebhookNotExist(err) { ctx.NotFound() @@ -68,7 +68,7 @@ func GetOwnerHook(ctx *context.APIContext, ownerID, hookID int64) (*webhook.Webh // GetRepoHook get a repo's webhook. If there is an error, write to `ctx` // accordingly and return the error func GetRepoHook(ctx *context.APIContext, repoID, hookID int64) (*webhook.Webhook, error) { - w, err := webhook.GetWebhookByRepoID(repoID, hookID) + w, err := webhook.GetWebhookByRepoID(ctx, repoID, hookID) if err != nil { if webhook.IsErrWebhookNotExist(err) { ctx.NotFound() @@ -392,7 +392,7 @@ func editHook(ctx *context.APIContext, form *api.EditHookOption, w *webhook.Webh w.IsActive = *form.Active } - if err := webhook.UpdateWebhook(w); err != nil { + if err := webhook.UpdateWebhook(ctx, w); err != nil { ctx.Error(http.StatusInternalServerError, "UpdateWebhook", err) return false } @@ -401,7 +401,7 @@ func editHook(ctx *context.APIContext, form *api.EditHookOption, w *webhook.Webh // DeleteOwnerHook deletes the hook owned by the owner. func DeleteOwnerHook(ctx *context.APIContext, owner *user_model.User, hookID int64) { - if err := webhook.DeleteWebhookByOwnerID(owner.ID, hookID); err != nil { + if err := webhook.DeleteWebhookByOwnerID(ctx, owner.ID, hookID); err != nil { if webhook.IsErrWebhookNotExist(err) { ctx.NotFound() } else { |