summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-07-10 17:26:50 +0800
committerUnknwon <u@gogs.io>2015-07-10 17:26:50 +0800
commitced212f8fa6e4761bca0c635240e8147ae427435 (patch)
tree83d366db0ceb967bb6a750efa0d9cf54a3ce8d5f /routers
parent35be8741c4523206aa3bff4aad1dda23847b381e (diff)
downloadgitea-ced212f8fa6e4761bca0c635240e8147ae427435.tar.gz
gitea-ced212f8fa6e4761bca0c635240e8147ae427435.zip
fix hidden bug on tpl rendering
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/setting.go21
1 files changed, 14 insertions, 7 deletions
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index cdcade67c0..756f297925 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -282,6 +282,7 @@ func WebHooksNew(ctx *middleware.Context) {
ctx.Data["PageIsSettingsHooksNew"] = true
ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}}
renderHookTypes(ctx)
+
orCtx, err := getOrgRepoCtx(ctx)
if err != nil {
ctx.Handle(500, "WebHooksNew(getOrgRepoCtx)", err)
@@ -296,6 +297,7 @@ func WebHooksNewPost(ctx *middleware.Context, form auth.NewWebhookForm) {
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["PageIsSettingsHooksNew"] = true
ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}}
+ renderHookTypes(ctx)
orCtx, err := getOrgRepoCtx(ctx)
if err != nil {
@@ -364,14 +366,10 @@ func WebHooksEdit(ctx *middleware.Context) {
// set data per HookTaskType
switch w.HookTaskType {
case models.SLACK:
- {
- ctx.Data["SlackHook"] = w.GetSlackHook()
- ctx.Data["HookType"] = "Slack"
- }
+ ctx.Data["SlackHook"] = w.GetSlackHook()
+ ctx.Data["HookType"] = "Slack"
default:
- {
- ctx.Data["HookType"] = "Gogs"
- }
+ ctx.Data["HookType"] = "Gogs"
}
w.GetEvent()
ctx.Data["Webhook"] = w
@@ -403,6 +401,15 @@ func WebHooksEditPost(ctx *middleware.Context, form auth.NewWebhookForm) {
}
return
}
+
+ // set data per HookTaskType
+ switch w.HookTaskType {
+ case models.SLACK:
+ ctx.Data["SlackHook"] = w.GetSlackHook()
+ ctx.Data["HookType"] = "Slack"
+ default:
+ ctx.Data["HookType"] = "Gogs"
+ }
w.GetEvent()
ctx.Data["Webhook"] = w