Skip to content

Commit 5b2d933

Browse files
jolheiserlafriks
authored andcommitted
Add HTML URL to API Issues (#9654)
* Add HTML URL to API Issues Signed-off-by: jolheiser <[email protected]> * Swagger Signed-off-by: jolheiser <[email protected]> Co-authored-by: Lauris BH <[email protected]>
1 parent 14a9687 commit 5b2d933

File tree

7 files changed

+10
-4
lines changed

7 files changed

+10
-4
lines changed

models/issue.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ func (issue *Issue) apiFormat(e Engine) *api.Issue {
381381
apiIssue := &api.Issue{
382382
ID: issue.ID,
383383
URL: issue.APIURL(),
384+
HTMLURL: issue.HTMLURL(),
384385
Index: issue.Index,
385386
Poster: issue.Poster.APIFormat(),
386387
Title: issue.Title,

modules/structs/issue.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type RepositoryMeta struct {
3838
type Issue struct {
3939
ID int64 `json:"id"`
4040
URL string `json:"url"`
41+
HTMLURL string `json:"html_url"`
4142
Index int64 `json:"number"`
4243
Poster *User `json:"user"`
4344
OriginalAuthor string `json:"original_author"`

modules/webhook/dingtalk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func getDingtalkIssuesPayload(p *api.IssuePayload) (*DingtalkPayload, error) {
142142
Title: issueTitle,
143143
HideAvatar: "0",
144144
SingleTitle: "view issue",
145-
SingleURL: p.Issue.URL,
145+
SingleURL: p.Issue.HTMLURL,
146146
},
147147
}, nil
148148
}

modules/webhook/discord.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ func getDiscordIssuesPayload(p *api.IssuePayload, meta *DiscordMeta) (*DiscordPa
236236
{
237237
Title: text,
238238
Description: attachmentText,
239-
URL: p.Issue.URL,
239+
URL: p.Issue.HTMLURL,
240240
Color: color,
241241
Author: DiscordEmbedAuthor{
242242
Name: p.Sender.UserName,

modules/webhook/msteams.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ func getMSTeamsIssuesPayload(p *api.IssuePayload) (*MSTeamsPayload, error) {
299299
Targets: []MSTeamsActionTarget{
300300
{
301301
Os: "default",
302-
URI: p.Issue.URL,
302+
URI: p.Issue.HTMLURL,
303303
},
304304
},
305305
},

modules/webhook/slack.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func getSlackIssuesPayload(p *api.IssuePayload, slack *SlackMeta) (*SlackPayload
158158
pl.Attachments = []SlackAttachment{{
159159
Color: fmt.Sprintf("%x", color),
160160
Title: issueTitle,
161-
TitleLink: p.Issue.URL,
161+
TitleLink: p.Issue.HTMLURL,
162162
Text: attachmentText,
163163
}}
164164
}

templates/swagger/v1_json.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10305,6 +10305,10 @@
1030510305
"format": "date-time",
1030610306
"x-go-name": "Deadline"
1030710307
},
10308+
"html_url": {
10309+
"type": "string",
10310+
"x-go-name": "HTMLURL"
10311+
},
1030810312
"id": {
1030910313
"type": "integer",
1031010314
"format": "int64",

0 commit comments

Comments
 (0)