From be6434662a8247545489c035e3630cf993dd345c Mon Sep 17 00:00:00 2001 From: oliverpool Date: Fri, 22 Mar 2024 11:52:39 +0100 Subject: [PATCH] [REFACTOR] webhook/new remove redundant if --- templates/webhook/new/dingtalk.tmpl | 20 ++++---- templates/webhook/new/discord.tmpl | 36 +++++++------- templates/webhook/new/feishu.tmpl | 22 ++++----- templates/webhook/new/forgejo.tmpl | 70 +++++++++++++-------------- templates/webhook/new/gitea.tmpl | 70 +++++++++++++-------------- templates/webhook/new/gogs.tmpl | 50 +++++++++---------- templates/webhook/new/matrix.tmpl | 48 +++++++++--------- templates/webhook/new/msteams.tmpl | 20 ++++---- templates/webhook/new/packagist.tmpl | 36 +++++++------- templates/webhook/new/slack.tmpl | 52 ++++++++++---------- templates/webhook/new/telegram.tmpl | 36 +++++++------- templates/webhook/new/wechatwork.tmpl | 20 ++++---- 12 files changed, 228 insertions(+), 252 deletions(-) diff --git a/templates/webhook/new/dingtalk.tmpl b/templates/webhook/new/dingtalk.tmpl index f1cd6a1932..398cb45f8c 100644 --- a/templates/webhook/new/dingtalk.tmpl +++ b/templates/webhook/new/dingtalk.tmpl @@ -1,11 +1,9 @@ -{{if eq .HookType "dingtalk"}} -

{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://dingtalk.com" (ctx.Locale.Tr "repo.settings.web_hook_name_dingtalk")}}

-
- {{.CsrfTokenHtml}} -
- - -
- {{template "repo/settings/webhook/settings" .}} -
-{{end}} +

{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://dingtalk.com" (ctx.Locale.Tr "repo.settings.web_hook_name_dingtalk")}}

+
+ {{.CsrfTokenHtml}} +
+ + +
+ {{template "repo/settings/webhook/settings" .}} +
diff --git a/templates/webhook/new/discord.tmpl b/templates/webhook/new/discord.tmpl index 95a3806c89..c6a7ea7d19 100644 --- a/templates/webhook/new/discord.tmpl +++ b/templates/webhook/new/discord.tmpl @@ -1,19 +1,17 @@ -{{if eq .HookType "discord"}} -

{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://discord.com" (ctx.Locale.Tr "repo.settings.web_hook_name_discord")}}

-
- {{.CsrfTokenHtml}} -
- - -
-
- - -
-
- - -
- {{template "repo/settings/webhook/settings" .}} -
-{{end}} +

{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://discord.com" (ctx.Locale.Tr "repo.settings.web_hook_name_discord")}}

+
+ {{.CsrfTokenHtml}} +
+ + +
+
+ + +
+
+ + +
+ {{template "repo/settings/webhook/settings" .}} +
diff --git a/templates/webhook/new/feishu.tmpl b/templates/webhook/new/feishu.tmpl index cd6aaf935a..b691c3f18c 100644 --- a/templates/webhook/new/feishu.tmpl +++ b/templates/webhook/new/feishu.tmpl @@ -1,12 +1,10 @@ -{{if eq .HookType "feishu"}} -

{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://feishu.cn" (ctx.Locale.Tr "repo.settings.web_hook_name_feishu")}}

-

{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://larksuite.com" (ctx.Locale.Tr "repo.settings.web_hook_name_larksuite")}}

-
- {{.CsrfTokenHtml}} -
- - -
- {{template "repo/settings/webhook/settings" .}} -
-{{end}} +

{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://feishu.cn" (ctx.Locale.Tr "repo.settings.web_hook_name_feishu")}}

+

{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://larksuite.com" (ctx.Locale.Tr "repo.settings.web_hook_name_larksuite")}}

+
+ {{.CsrfTokenHtml}} +
+ + +
+ {{template "repo/settings/webhook/settings" .}} +
diff --git a/templates/webhook/new/forgejo.tmpl b/templates/webhook/new/forgejo.tmpl index 5c8233a638..6bc4eb489e 100644 --- a/templates/webhook/new/forgejo.tmpl +++ b/templates/webhook/new/forgejo.tmpl @@ -1,40 +1,38 @@ -{{if eq .HookType "forgejo"}} -

{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://forgejo.org/docs/latest/user/webhooks/" (ctx.Locale.Tr "repo.settings.web_hook_name_forgejo")}}

-
- {{template "base/disable_form_autofill"}} - {{.CsrfTokenHtml}} -
- - -
-
- -