1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Implementation of discord webhook (#2402)

* implementation of discord webhook

* fix webhooks

* fix typo and unnecessary color values

* fix typo

* fix imports and revert changes to webhook_slack.go
This commit is contained in:
Lunny Xiao
2017-08-28 13:06:45 +08:00
committed by GitHub
parent e41da3845d
commit ced50e0ec1
11 changed files with 427 additions and 14 deletions

View File

@@ -0,0 +1,19 @@
{{if eq .HookType "discord"}}
<p>{{.i18n.Tr "repo.settings.add_discord_hook_desc" "https://discordapp.com" | Str2html}}</p>
<form class="ui form" action="{{.BaseLink}}/settings/hooks/discord/{{if .PageIsSettingsHooksNew}}new{{else}}{{.Webhook.ID}}{{end}}" method="post">
{{.CsrfTokenHtml}}
<div class="required field {{if .Err_PayloadURL}}error{{end}}">
<label for="payload_url">{{.i18n.Tr "repo.settings.payload_url"}}</label>
<input id="payload_url" name="payload_url" type="url" value="{{.Webhook.URL}}" autofocus required>
</div>
<div class="field">
<label for="username">{{.i18n.Tr "repo.settings.discord_username"}}</label>
<input id="username" name="username" value="{{.DiscordHook.Username}}" placeholder="e.g. Gitea">
</div>
<div class="field">
<label for="icon_url">{{.i18n.Tr "repo.settings.discord_icon_url"}}</label>
<input id="icon_url" name="icon_url" value="{{.DiscordHook.IconURL}}" placeholder="e.g. https://example.com/img/favicon.png">
</div>
{{template "repo/settings/hook_settings" .}}
</form>
{{end}}

View File

@@ -14,6 +14,9 @@
<a class="item" href="{{.BaseLink}}/settings/hooks/slack/new">
<img class="img-10" src="{{AppSubUrl}}/img/slack.png">Slack
</a>
<a class="item" href="{{.BaseLink}}/settings/hooks/discord/new">
<img class="img-10" src="{{AppSubUrl}}/img/discord.png">Discord
</a>
</div>
</div>
</div>

View File

@@ -13,6 +13,8 @@
<img class="img-13" src="{{AppSubUrl}}/img/gogs.ico">
{{else if eq .HookType "slack"}}
<img class="img-13" src="{{AppSubUrl}}/img/slack.png">
{{else if eq .HookType "discord"}}
<img class="img-13" src="{{AppSubUrl}}/img/discord.png">
{{end}}
</div>
</h4>
@@ -20,6 +22,7 @@
{{template "repo/settings/hook_gitea" .}}
{{template "repo/settings/hook_gogs" .}}
{{template "repo/settings/hook_slack" .}}
{{template "repo/settings/hook_discord" .}}
</div>
{{template "repo/settings/hook_history" .}}