summaryrefslogtreecommitdiffstats
path: root/routers/web/repo/webhook.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2022-03-22 23:22:54 +0800
committerGitHub <noreply@github.com>2022-03-22 16:22:54 +0100
commit7a550b3af20dad94cf468012a6b817b43b91c1ba (patch)
tree1b836eabf8e911f35d0446c0cdad053cb3572c79 /routers/web/repo/webhook.go
parent2b55422cd71b0b325f054646de5cebf39b72b502 (diff)
downloadgitea-7a550b3af20dad94cf468012a6b817b43b91c1ba.tar.gz
gitea-7a550b3af20dad94cf468012a6b817b43b91c1ba.zip
Use `ctx` instead of `db.DefaultContext` in some packages(routers/services/modules) (#19163)
* Remove `db.DefaultContext` usage in routers, use `ctx` directly * Use `ctx` directly if there is one, remove some `db.DefaultContext` in `services` * Use ctx instead of db.DefaultContext for `cmd` and some `modules` packages * fix incorrect context usage
Diffstat (limited to 'routers/web/repo/webhook.go')
-rw-r--r--routers/web/repo/webhook.go23
1 files changed, 11 insertions, 12 deletions
diff --git a/routers/web/repo/webhook.go b/routers/web/repo/webhook.go
index d457bcb190..7ffea1724a 100644
--- a/routers/web/repo/webhook.go
+++ b/routers/web/repo/webhook.go
@@ -13,7 +13,6 @@ import (
"path"
"strings"
- "code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/perm"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/models/webhook"
@@ -227,7 +226,7 @@ func GiteaHooksNewPost(ctx *context.Context) {
if err := w.UpdateEvent(); err != nil {
ctx.ServerError("UpdateEvent", err)
return
- } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil {
+ } else if err := webhook.CreateWebhook(ctx, w); err != nil {
ctx.ServerError("CreateWebhook", err)
return
}
@@ -281,7 +280,7 @@ func newGogsWebhookPost(ctx *context.Context, form forms.NewGogshookForm, kind w
if err := w.UpdateEvent(); err != nil {
ctx.ServerError("UpdateEvent", err)
return
- } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil {
+ } else if err := webhook.CreateWebhook(ctx, w); err != nil {
ctx.ServerError("CreateWebhook", err)
return
}
@@ -333,7 +332,7 @@ func DiscordHooksNewPost(ctx *context.Context) {
if err := w.UpdateEvent(); err != nil {
ctx.ServerError("UpdateEvent", err)
return
- } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil {
+ } else if err := webhook.CreateWebhook(ctx, w); err != nil {
ctx.ServerError("CreateWebhook", err)
return
}
@@ -376,7 +375,7 @@ func DingtalkHooksNewPost(ctx *context.Context) {
if err := w.UpdateEvent(); err != nil {
ctx.ServerError("UpdateEvent", err)
return
- } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil {
+ } else if err := webhook.CreateWebhook(ctx, w); err != nil {
ctx.ServerError("CreateWebhook", err)
return
}
@@ -428,7 +427,7 @@ func TelegramHooksNewPost(ctx *context.Context) {
if err := w.UpdateEvent(); err != nil {
ctx.ServerError("UpdateEvent", err)
return
- } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil {
+ } else if err := webhook.CreateWebhook(ctx, w); err != nil {
ctx.ServerError("CreateWebhook", err)
return
}
@@ -483,7 +482,7 @@ func MatrixHooksNewPost(ctx *context.Context) {
if err := w.UpdateEvent(); err != nil {
ctx.ServerError("UpdateEvent", err)
return
- } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil {
+ } else if err := webhook.CreateWebhook(ctx, w); err != nil {
ctx.ServerError("CreateWebhook", err)
return
}
@@ -526,7 +525,7 @@ func MSTeamsHooksNewPost(ctx *context.Context) {
if err := w.UpdateEvent(); err != nil {
ctx.ServerError("UpdateEvent", err)
return
- } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil {
+ } else if err := webhook.CreateWebhook(ctx, w); err != nil {
ctx.ServerError("CreateWebhook", err)
return
}
@@ -586,7 +585,7 @@ func SlackHooksNewPost(ctx *context.Context) {
if err := w.UpdateEvent(); err != nil {
ctx.ServerError("UpdateEvent", err)
return
- } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil {
+ } else if err := webhook.CreateWebhook(ctx, w); err != nil {
ctx.ServerError("CreateWebhook", err)
return
}
@@ -629,7 +628,7 @@ func FeishuHooksNewPost(ctx *context.Context) {
if err := w.UpdateEvent(); err != nil {
ctx.ServerError("UpdateEvent", err)
return
- } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil {
+ } else if err := webhook.CreateWebhook(ctx, w); err != nil {
ctx.ServerError("CreateWebhook", err)
return
}
@@ -673,7 +672,7 @@ func WechatworkHooksNewPost(ctx *context.Context) {
if err := w.UpdateEvent(); err != nil {
ctx.ServerError("UpdateEvent", err)
return
- } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil {
+ } else if err := webhook.CreateWebhook(ctx, w); err != nil {
ctx.ServerError("CreateWebhook", err)
return
}
@@ -726,7 +725,7 @@ func PackagistHooksNewPost(ctx *context.Context) {
if err := w.UpdateEvent(); err != nil {
ctx.ServerError("UpdateEvent", err)
return
- } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil {
+ } else if err := webhook.CreateWebhook(ctx, w); err != nil {
ctx.ServerError("CreateWebhook", err)
return
}