summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcrito <esno@users.noreply.github.com>2018-09-18 09:04:46 +0200
committertechknowlogick <techknowlogick@users.noreply.github.com>2018-09-17 21:04:46 -1000
commitd6b97c8557fc8707c6b1d1ead26ec82a0ac8a2d5 (patch)
tree9f7bbd1bc1fa4f30d54f0011037c68b14a169ec9
parent4befec242aa3563f5a8a38bd390d834e4aa2797b (diff)
downloadgitea-d6b97c8557fc8707c6b1d1ead26ec82a0ac8a2d5.tar.gz
gitea-d6b97c8557fc8707c6b1d1ead26ec82a0ac8a2d5.zip
fix url in discord webhook (#4953)
opening issues generates a webhook to discord that contains a url to the gitea api. the message title in discord is therefore referencing to the api instead of the issue itself.
-rw-r--r--models/webhook_discord.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/models/webhook_discord.go b/models/webhook_discord.go
index 95fca2ee6f..77634fbe9a 100644
--- a/models/webhook_discord.go
+++ b/models/webhook_discord.go
@@ -213,6 +213,7 @@ func getDiscordPushPayload(p *api.PushPayload, meta *DiscordMeta) (*DiscordPaylo
func getDiscordIssuesPayload(p *api.IssuePayload, meta *DiscordMeta) (*DiscordPayload, error) {
var text, title string
var color int
+ url := fmt.Sprintf("%s/issues/%d", p.Repository.HTMLURL, p.Issue.Index)
switch p.Action {
case api.HookIssueOpened:
title = fmt.Sprintf("[%s] Issue opened: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
@@ -268,7 +269,7 @@ func getDiscordIssuesPayload(p *api.IssuePayload, meta *DiscordMeta) (*DiscordPa
{
Title: title,
Description: text,
- URL: p.Issue.URL,
+ URL: url,
Color: color,
Author: DiscordEmbedAuthor{
Name: p.Sender.UserName,