Skip to content

Commit d6b97c8

Browse files
esnotechknowlogick
authored andcommitted
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.
1 parent 4befec2 commit d6b97c8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

models/webhook_discord.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ func getDiscordPushPayload(p *api.PushPayload, meta *DiscordMeta) (*DiscordPaylo
213213
func getDiscordIssuesPayload(p *api.IssuePayload, meta *DiscordMeta) (*DiscordPayload, error) {
214214
var text, title string
215215
var color int
216+
url := fmt.Sprintf("%s/issues/%d", p.Repository.HTMLURL, p.Issue.Index)
216217
switch p.Action {
217218
case api.HookIssueOpened:
218219
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
268269
{
269270
Title: title,
270271
Description: text,
271-
URL: p.Issue.URL,
272+
URL: url,
272273
Color: color,
273274
Author: DiscordEmbedAuthor{
274275
Name: p.Sender.UserName,

0 commit comments

Comments
 (0)