diff options
author | Unknwon <u@gogs.io> | 2016-07-16 01:02:55 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-07-16 01:02:55 +0800 |
commit | 3d93532c87823159dd03e9c64a58c7bafed0fa64 (patch) | |
tree | cdf287400fd753711138486ce06766b3c789d96a /routers/repo/webhook.go | |
parent | fff615d5fc257c812f197a801578f32c177fbef9 (diff) | |
download | gitea-3d93532c87823159dd03e9c64a58c7bafed0fa64.tar.gz gitea-3d93532c87823159dd03e9c64a58c7bafed0fa64.zip |
#3274 fix can't get webhook detail of organization
Diffstat (limited to 'routers/repo/webhook.go')
-rw-r--r-- | routers/repo/webhook.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go index d904862359..b2274033b0 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) |