Skip to content

Commit

Permalink
fix url in discord webhook (#4953)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
esno authored and techknowlogick committed Sep 18, 2018
1 parent 4befec2 commit d6b97c8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion models/webhook_discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d6b97c8

Please sign in to comment.