[REFACTOR] webhook/new remove redundant if

This commit is contained in:
oliverpool 2024-03-22 11:52:39 +01:00
parent 9558b18d22
commit be6434662a
12 changed files with 228 additions and 252 deletions

View file

@ -1,4 +1,3 @@
{{if eq .HookType "dingtalk"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://dingtalk.com" (ctx.Locale.Tr "repo.settings.web_hook_name_dingtalk")}}</p>
<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "dingtalk/new"}}" method="post">
{{.CsrfTokenHtml}}
@ -8,4 +7,3 @@
</div>
{{template "repo/settings/webhook/settings" .}}
</form>
{{end}}

View file

@ -1,4 +1,3 @@
{{if eq .HookType "discord"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://discord.com" (ctx.Locale.Tr "repo.settings.web_hook_name_discord")}}</p>
<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "discord/new"}}" method="post">
{{.CsrfTokenHtml}}
@ -16,4 +15,3 @@
</div>
{{template "repo/settings/webhook/settings" .}}
</form>
{{end}}

View file

@ -1,4 +1,3 @@
{{if eq .HookType "feishu"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://feishu.cn" (ctx.Locale.Tr "repo.settings.web_hook_name_feishu")}}</p>
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://larksuite.com" (ctx.Locale.Tr "repo.settings.web_hook_name_larksuite")}}</p>
<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "feishu/new"}}" method="post">
@ -9,4 +8,3 @@
</div>
{{template "repo/settings/webhook/settings" .}}
</form>
{{end}}

View file

@ -1,4 +1,3 @@
{{if eq .HookType "forgejo"}}
<p>{{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")}}</p>
<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "forgejo/new"}}" method="post">
{{template "base/disable_form_autofill"}}
@ -37,4 +36,3 @@
</div>
{{template "repo/settings/webhook/settings" .}}
</form>
{{end}}

View file

@ -1,4 +1,3 @@
{{if eq .HookType "gitea"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://forgejo.org/docs/latest/user/webhooks/" (ctx.Locale.Tr "repo.settings.web_hook_name_gitea")}}</p>
<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "gitea/new"}}" method="post">
{{template "base/disable_form_autofill"}}
@ -37,4 +36,3 @@
</div>
{{template "repo/settings/webhook/settings" .}}
</form>
{{end}}

View file

@ -1,4 +1,3 @@
{{if eq .HookType "gogs"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://forgejo.org/docs/latest/user/webhooks/" (ctx.Locale.Tr "repo.settings.web_hook_name_gogs")}}</p>
<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "gogs/new"}}" method="post">
{{template "base/disable_form_autofill"}}
@ -25,4 +24,3 @@
</div>
{{template "repo/settings/webhook/settings" .}}
</form>
{{end}}

View file

@ -1,4 +1,3 @@
{{if eq .HookType "matrix"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://matrix.org/" (ctx.Locale.Tr "repo.settings.web_hook_name_matrix")}}</p>
<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "matrix/new"}}" method="post">
{{.CsrfTokenHtml}}
@ -24,4 +23,3 @@
</div>
{{template "repo/settings/webhook/settings" .}}
</form>
{{end}}

View file

@ -1,4 +1,3 @@
{{if eq .HookType "msteams"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://teams.microsoft.com" (ctx.Locale.Tr "repo.settings.web_hook_name_msteams")}}</p>
<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "msteams/new"}}" method="post">
{{.CsrfTokenHtml}}
@ -8,4 +7,3 @@
</div>
{{template "repo/settings/webhook/settings" .}}
</form>
{{end}}

View file

@ -1,4 +1,3 @@
{{if eq .HookType "packagist"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://packagist.org" (ctx.Locale.Tr "repo.settings.web_hook_name_packagist")}}</p>
<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "packagist/new"}}" method="post">
{{.CsrfTokenHtml}}
@ -16,4 +15,3 @@
</div>
{{template "repo/settings/webhook/settings" .}}
</form>
{{end}}

View file

@ -1,4 +1,3 @@
{{if eq .HookType "slack"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://slack.com" (ctx.Locale.Tr "repo.settings.web_hook_name_slack")}}</p>
<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "slack/new"}}" method="post">
{{.CsrfTokenHtml}}
@ -25,4 +24,3 @@
</div>
{{template "repo/settings/webhook/settings" .}}
</form>
{{end}}

View file

@ -1,4 +1,3 @@
{{if eq .HookType "telegram"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://core.telegram.org/bots" (ctx.Locale.Tr "repo.settings.web_hook_name_telegram")}}</p>
<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "telegram/new"}}" method="post">
{{.CsrfTokenHtml}}
@ -16,4 +15,3 @@
</div>
{{template "repo/settings/webhook/settings" .}}
</form>
{{end}}

View file

@ -1,4 +1,3 @@
{{if eq .HookType "wechatwork"}}
<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://work.weixin.qq.com" (ctx.Locale.Tr "repo.settings.web_hook_name_wechatwork")}}</p>
<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "wechatwork/new"}}" method="post">
{{.CsrfTokenHtml}}
@ -8,4 +7,3 @@
</div>
{{template "repo/settings/webhook/settings" .}}
</form>
{{end}}