aboutsummaryrefslogtreecommitdiff
path: root/routers/repo/webhook.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/webhook.go')
-rw-r--r--routers/repo/webhook.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go
index d9048623..b2274033 100644
--- a/routers/repo/webhook.go
+++ b/routers/repo/webhook.go
@@ -220,7 +220,12 @@ func checkWebhook(ctx *context.Context) (*OrgRepoCtx, *models.Webhook) {
}
ctx.Data["BaseLink"] = orCtx.Link
- w, err := models.GetWebhookByID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))
+ var w *models.Webhook
+ if orCtx.RepoID > 0 {
+ w, err = models.GetWebhookByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))
+ } else {
+ w, err = models.GetWebhookByOrgID(ctx.Org.Organization.Id, ctx.ParamsInt64(":id"))
+ }
if err != nil {
if models.IsErrWebhookNotExist(err) {
ctx.Handle(404, "GetWebhookByID", nil)