diff options
author | kolaente <k@knt.li> | 2020-05-15 21:02:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-15 22:02:46 +0300 |
commit | c72a471215a77b1bd6d117f4df5bbdcc858d25a3 (patch) | |
tree | c0dcdf859a4d91b82ddc5d84a40af5a32bed4b77 /routers | |
parent | 57217cabe34e2a01fbb3cb93bd93fbefa38fee91 (diff) | |
download | gitea-c72a471215a77b1bd6d117f4df5bbdcc858d25a3.tar.gz gitea-c72a471215a77b1bd6d117f4df5bbdcc858d25a3.zip |
Fix webhook template when validation errors occur (#11421)
Signed-off-by: kolaente <k@knt.li>
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/webhook.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go index c624848549..7ac403b462 100644 --- a/routers/repo/webhook.go +++ b/routers/repo/webhook.go @@ -180,7 +180,7 @@ func GiteaHooksNewPost(ctx *context.Context, form auth.NewWebhookForm) { ctx.Data["PageIsSettingsHooks"] = true ctx.Data["PageIsSettingsHooksNew"] = true ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}} - ctx.Data["HookType"] = "gitea" + ctx.Data["HookType"] = models.GITEA.Name() orCtx, err := getOrgRepoCtx(ctx) if err != nil { @@ -234,7 +234,7 @@ func newGogsWebhookPost(ctx *context.Context, form auth.NewGogshookForm, kind mo ctx.Data["PageIsSettingsHooks"] = true ctx.Data["PageIsSettingsHooksNew"] = true ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}} - ctx.Data["HookType"] = "gogs" + ctx.Data["HookType"] = models.GOGS.Name() orCtx, err := getOrgRepoCtx(ctx) if err != nil { @@ -282,6 +282,7 @@ func DiscordHooksNewPost(ctx *context.Context, form auth.NewDiscordHookForm) { ctx.Data["PageIsSettingsHooks"] = true ctx.Data["PageIsSettingsHooksNew"] = true ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}} + ctx.Data["HookType"] = models.DISCORD.Name() orCtx, err := getOrgRepoCtx(ctx) if err != nil { @@ -332,6 +333,7 @@ func DingtalkHooksNewPost(ctx *context.Context, form auth.NewDingtalkHookForm) { ctx.Data["PageIsSettingsHooks"] = true ctx.Data["PageIsSettingsHooksNew"] = true ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}} + ctx.Data["HookType"] = models.DINGTALK.Name() orCtx, err := getOrgRepoCtx(ctx) if err != nil { @@ -373,6 +375,7 @@ func TelegramHooksNewPost(ctx *context.Context, form auth.NewTelegramHookForm) { ctx.Data["PageIsSettingsHooks"] = true ctx.Data["PageIsSettingsHooksNew"] = true ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}} + ctx.Data["HookType"] = models.TELEGRAM.Name() orCtx, err := getOrgRepoCtx(ctx) if err != nil { @@ -423,6 +426,7 @@ func MatrixHooksNewPost(ctx *context.Context, form auth.NewMatrixHookForm) { ctx.Data["PageIsSettingsHooks"] = true ctx.Data["PageIsSettingsHooksNew"] = true ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}} + ctx.Data["HookType"] = models.MATRIX.Name() orCtx, err := getOrgRepoCtx(ctx) if err != nil { @@ -475,6 +479,7 @@ func MSTeamsHooksNewPost(ctx *context.Context, form auth.NewMSTeamsHookForm) { ctx.Data["PageIsSettingsHooks"] = true ctx.Data["PageIsSettingsHooksNew"] = true ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}} + ctx.Data["HookType"] = models.MSTEAMS.Name() orCtx, err := getOrgRepoCtx(ctx) if err != nil { @@ -516,6 +521,7 @@ func SlackHooksNewPost(ctx *context.Context, form auth.NewSlackHookForm) { ctx.Data["PageIsSettingsHooks"] = true ctx.Data["PageIsSettingsHooksNew"] = true ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}} + ctx.Data["HookType"] = models.SLACK.Name() orCtx, err := getOrgRepoCtx(ctx) if err != nil { @@ -574,6 +580,7 @@ func FeishuHooksNewPost(ctx *context.Context, form auth.NewFeishuHookForm) { ctx.Data["PageIsSettingsHooks"] = true ctx.Data["PageIsSettingsHooksNew"] = true ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}} + ctx.Data["HookType"] = models.FEISHU.Name() orCtx, err := getOrgRepoCtx(ctx) if err != nil { |