Skip to content

Commit 04a77b1

Browse files
jolheiserlafriks
andcommitted
Add HTML URL to API Issues (#9654) (#9661)
* 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]> Co-authored-by: Lauris BH <[email protected]>
1 parent f523372 commit 04a77b1

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
@@ -10179,6 +10179,10 @@
1017910179
"format": "date-time",
1018010180
"x-go-name": "Deadline"
1018110181
},
10182+
"html_url": {
10183+
"type": "string",
10184+
"x-go-name": "HTMLURL"
10185+
},
1018210186
"id": {
1018310187
"type": "integer",
1018410188
"format": "int64",

0 commit comments

Comments
 (0)