]> source.dussan.org Git - gitea.git/commitdiff
fix url in discord webhook (#4953)
authorcrito <esno@users.noreply.github.com>
Tue, 18 Sep 2018 07:04:46 +0000 (09:04 +0200)
committertechknowlogick <techknowlogick@users.noreply.github.com>
Tue, 18 Sep 2018 07:04:46 +0000 (21:04 -1000)
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.

models/webhook_discord.go

index 95fca2ee6f1d9ff77b5994bf84903925c375f9d4..77634fbe9a8f6f54a8cf65e1b371beca61c6fe71 100644 (file)
@@ -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,