diff options
author | Unknwon <u@gogs.io> | 2017-02-21 20:21:25 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-02-21 20:21:25 -0500 |
commit | 60aca9ea18f4fed6c98c83d41036f9a34fdbd28c (patch) | |
tree | 5fbf8009c9997678e4d9dedde80d98fd1e489cc8 /routers/repo/webhook.go | |
parent | 6a8ad0b3574c3ab1f3a441493dc002b805b45a38 (diff) |
webhook: also only enable certain types (#3356)
Add new config option '[webhook] TYPES’.
Diffstat (limited to 'routers/repo/webhook.go')
-rw-r--r-- | routers/repo/webhook.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go index 542fa635..07b9432b 100644 --- a/routers/repo/webhook.go +++ b/routers/repo/webhook.go @@ -23,9 +23,9 @@ import ( ) const ( - HOOKS base.TplName = "repo/settings/hooks" - HOOK_NEW base.TplName = "repo/settings/hook_new" - ORG_HOOK_NEW base.TplName = "org/settings/hook_new" + WEBHOOKS base.TplName = "repo/settings/webhooks" + WEBHOOK_NEW base.TplName = "repo/settings/webhook_new" + ORG_WEBHOOK_NEW base.TplName = "org/settings/webhook_new" ) func Webhooks(ctx *context.Context) { @@ -33,6 +33,7 @@ func Webhooks(ctx *context.Context) { ctx.Data["PageIsSettingsHooks"] = true ctx.Data["BaseLink"] = ctx.Repo.RepoLink ctx.Data["Description"] = ctx.Tr("repo.settings.hooks_desc", "https://github.com/gogits/go-gogs-client/wiki/Repositories-Webhooks") + ctx.Data["Types"] = setting.Webhook.Types ws, err := models.GetWebhooksByRepoID(ctx.Repo.Repository.ID) if err != nil { @@ -41,7 +42,7 @@ func Webhooks(ctx *context.Context) { } ctx.Data["Webhooks"] = ws - ctx.HTML(200, HOOKS) + ctx.HTML(200, WEBHOOKS) } type OrgRepoCtx struct { @@ -57,7 +58,7 @@ func getOrgRepoCtx(ctx *context.Context) (*OrgRepoCtx, error) { return &OrgRepoCtx{ RepoID: ctx.Repo.Repository.ID, Link: ctx.Repo.RepoLink, - NewTemplate: HOOK_NEW, + NewTemplate: WEBHOOK_NEW, }, nil } @@ -65,7 +66,7 @@ func getOrgRepoCtx(ctx *context.Context) (*OrgRepoCtx, error) { return &OrgRepoCtx{ OrgID: ctx.Org.Organization.ID, Link: ctx.Org.OrgLink, - NewTemplate: ORG_HOOK_NEW, + NewTemplate: ORG_WEBHOOK_NEW, }, nil } |