From 9558b18d2284ac9617015b36dd971699fafb30b6 Mon Sep 17 00:00:00 2001 From: oliverpool Date: Fri, 22 Mar 2024 11:50:59 +0100 Subject: [PATCH] [REFACTOR] webhook move templates --- templates/webhook/new.tmpl | 40 +++++++++++++------ .../webhook => webhook/new}/dingtalk.tmpl | 0 .../webhook => webhook/new}/discord.tmpl | 0 .../webhook => webhook/new}/feishu.tmpl | 0 .../webhook => webhook/new}/forgejo.tmpl | 0 .../webhook => webhook/new}/gitea.tmpl | 0 .../webhook => webhook/new}/gogs.tmpl | 0 .../webhook => webhook/new}/matrix.tmpl | 0 .../webhook => webhook/new}/msteams.tmpl | 0 .../webhook => webhook/new}/packagist.tmpl | 0 .../webhook => webhook/new}/slack.tmpl | 0 .../webhook => webhook/new}/telegram.tmpl | 0 .../webhook => webhook/new}/wechatwork.tmpl | 0 13 files changed, 28 insertions(+), 12 deletions(-) rename templates/{repo/settings/webhook => webhook/new}/dingtalk.tmpl (100%) rename templates/{repo/settings/webhook => webhook/new}/discord.tmpl (100%) rename templates/{repo/settings/webhook => webhook/new}/feishu.tmpl (100%) rename templates/{repo/settings/webhook => webhook/new}/forgejo.tmpl (100%) rename templates/{repo/settings/webhook => webhook/new}/gitea.tmpl (100%) rename templates/{repo/settings/webhook => webhook/new}/gogs.tmpl (100%) rename templates/{repo/settings/webhook => webhook/new}/matrix.tmpl (100%) rename templates/{repo/settings/webhook => webhook/new}/msteams.tmpl (100%) rename templates/{repo/settings/webhook => webhook/new}/packagist.tmpl (100%) rename templates/{repo/settings/webhook => webhook/new}/slack.tmpl (100%) rename templates/{repo/settings/webhook => webhook/new}/telegram.tmpl (100%) rename templates/{repo/settings/webhook => webhook/new}/wechatwork.tmpl (100%) diff --git a/templates/webhook/new.tmpl b/templates/webhook/new.tmpl index 0347455f2c..17eb578b0e 100644 --- a/templates/webhook/new.tmpl +++ b/templates/webhook/new.tmpl @@ -10,17 +10,33 @@
- {{template "repo/settings/webhook/forgejo" .ctxData}} - {{template "repo/settings/webhook/gitea" .ctxData}} - {{template "repo/settings/webhook/gogs" .ctxData}} - {{template "repo/settings/webhook/slack" .ctxData}} - {{template "repo/settings/webhook/discord" .ctxData}} - {{template "repo/settings/webhook/dingtalk" .ctxData}} - {{template "repo/settings/webhook/telegram" .ctxData}} - {{template "repo/settings/webhook/msteams" .ctxData}} - {{template "repo/settings/webhook/feishu" .ctxData}} - {{template "repo/settings/webhook/matrix" .ctxData}} - {{template "repo/settings/webhook/wechatwork" .ctxData}} - {{template "repo/settings/webhook/packagist" .ctxData}} + {{with .ctxData}} + + {{if eq .HookType "forgejo"}} + {{template "webhook/new/forgejo" .}} + {{else if eq .HookType "gitea"}} + {{template "webhook/new/gitea" .}} + {{else if eq .HookType "gogs"}} + {{template "webhook/new/gogs" .}} + {{else if eq .HookType "slack"}} + {{template "webhook/new/slack" .}} + {{else if eq .HookType "discord"}} + {{template "webhook/new/discord" .}} + {{else if eq .HookType "dingtalk"}} + {{template "webhook/new/dingtalk" .}} + {{else if eq .HookType "telegram"}} + {{template "webhook/new/telegram" .}} + {{else if eq .HookType "msteams"}} + {{template "webhook/new/msteams" .}} + {{else if eq .HookType "feishu"}} + {{template "webhook/new/feishu" .}} + {{else if eq .HookType "matrix"}} + {{template "webhook/new/matrix" .}} + {{else if eq .HookType "wechatwork"}} + {{template "webhook/new/wechatwork" .}} + {{else if eq .HookType "packagist"}} + {{template "webhook/new/packagist" .}} + {{end}} + {{end}}
{{template "repo/settings/webhook/history" .ctxData}} diff --git a/templates/repo/settings/webhook/dingtalk.tmpl b/templates/webhook/new/dingtalk.tmpl similarity index 100% rename from templates/repo/settings/webhook/dingtalk.tmpl rename to templates/webhook/new/dingtalk.tmpl diff --git a/templates/repo/settings/webhook/discord.tmpl b/templates/webhook/new/discord.tmpl similarity index 100% rename from templates/repo/settings/webhook/discord.tmpl rename to templates/webhook/new/discord.tmpl diff --git a/templates/repo/settings/webhook/feishu.tmpl b/templates/webhook/new/feishu.tmpl similarity index 100% rename from templates/repo/settings/webhook/feishu.tmpl rename to templates/webhook/new/feishu.tmpl diff --git a/templates/repo/settings/webhook/forgejo.tmpl b/templates/webhook/new/forgejo.tmpl similarity index 100% rename from templates/repo/settings/webhook/forgejo.tmpl rename to templates/webhook/new/forgejo.tmpl diff --git a/templates/repo/settings/webhook/gitea.tmpl b/templates/webhook/new/gitea.tmpl similarity index 100% rename from templates/repo/settings/webhook/gitea.tmpl rename to templates/webhook/new/gitea.tmpl diff --git a/templates/repo/settings/webhook/gogs.tmpl b/templates/webhook/new/gogs.tmpl similarity index 100% rename from templates/repo/settings/webhook/gogs.tmpl rename to templates/webhook/new/gogs.tmpl diff --git a/templates/repo/settings/webhook/matrix.tmpl b/templates/webhook/new/matrix.tmpl similarity index 100% rename from templates/repo/settings/webhook/matrix.tmpl rename to templates/webhook/new/matrix.tmpl diff --git a/templates/repo/settings/webhook/msteams.tmpl b/templates/webhook/new/msteams.tmpl similarity index 100% rename from templates/repo/settings/webhook/msteams.tmpl rename to templates/webhook/new/msteams.tmpl diff --git a/templates/repo/settings/webhook/packagist.tmpl b/templates/webhook/new/packagist.tmpl similarity index 100% rename from templates/repo/settings/webhook/packagist.tmpl rename to templates/webhook/new/packagist.tmpl diff --git a/templates/repo/settings/webhook/slack.tmpl b/templates/webhook/new/slack.tmpl similarity index 100% rename from templates/repo/settings/webhook/slack.tmpl rename to templates/webhook/new/slack.tmpl diff --git a/templates/repo/settings/webhook/telegram.tmpl b/templates/webhook/new/telegram.tmpl similarity index 100% rename from templates/repo/settings/webhook/telegram.tmpl rename to templates/webhook/new/telegram.tmpl diff --git a/templates/repo/settings/webhook/wechatwork.tmpl b/templates/webhook/new/wechatwork.tmpl similarity index 100% rename from templates/repo/settings/webhook/wechatwork.tmpl rename to templates/webhook/new/wechatwork.tmpl