]> source.dussan.org Git - gitea.git/commitdiff
Add HTML URL to API Issues (#9654) (#9661)
authorJohn Olheiser <42128690+jolheiser@users.noreply.github.com>
Thu, 9 Jan 2020 06:07:21 +0000 (00:07 -0600)
committerLauris BH <lauris@nix.lv>
Thu, 9 Jan 2020 06:07:21 +0000 (08:07 +0200)
* Add HTML URL to API Issues

Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Swagger

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lauris BH <lauris@nix.lv>
models/issue.go
modules/structs/issue.go
modules/webhook/dingtalk.go
modules/webhook/discord.go
modules/webhook/msteams.go
modules/webhook/slack.go
templates/swagger/v1_json.tmpl

index 485be4baef7bebf8f380d5a5d8a3c7713e953626..3986aeee15c120f5888711d1778d6e3d6d52b631 100644 (file)
@@ -381,6 +381,7 @@ func (issue *Issue) apiFormat(e Engine) *api.Issue {
        apiIssue := &api.Issue{
                ID:       issue.ID,
                URL:      issue.APIURL(),
+               HTMLURL:  issue.HTMLURL(),
                Index:    issue.Index,
                Poster:   issue.Poster.APIFormat(),
                Title:    issue.Title,
index cc640edab05b881414ea28c15c894ad4c4e3d9b8..49a7dc6d6fed0f33569e413cb225ed0528db2953 100644 (file)
@@ -38,6 +38,7 @@ type RepositoryMeta struct {
 type Issue struct {
        ID               int64      `json:"id"`
        URL              string     `json:"url"`
+       HTMLURL          string     `json:"html_url"`
        Index            int64      `json:"number"`
        Poster           *User      `json:"user"`
        OriginalAuthor   string     `json:"original_author"`
index 0d569f412076bce2585ecdfe69857918e338e143..fc99202a70c5c2b24fd05269a72b03f83df62583 100644 (file)
@@ -142,7 +142,7 @@ func getDingtalkIssuesPayload(p *api.IssuePayload) (*DingtalkPayload, error) {
                        Title:       issueTitle,
                        HideAvatar:  "0",
                        SingleTitle: "view issue",
-                       SingleURL:   p.Issue.URL,
+                       SingleURL:   p.Issue.HTMLURL,
                },
        }, nil
 }
index c1e8421228ef151a892d6ce6a0338e48b6fef18e..732821c1830c94e4d0d3c6e1e79fbdf99ed8de6f 100644 (file)
@@ -236,7 +236,7 @@ func getDiscordIssuesPayload(p *api.IssuePayload, meta *DiscordMeta) (*DiscordPa
                        {
                                Title:       text,
                                Description: attachmentText,
-                               URL:         p.Issue.URL,
+                               URL:         p.Issue.HTMLURL,
                                Color:       color,
                                Author: DiscordEmbedAuthor{
                                        Name:    p.Sender.UserName,
index b47725209d95e420097e399fab8563604b5bde36..b9ceb5ee0b51ef560bd27ca0f1c2e8940397ac9f 100644 (file)
@@ -299,7 +299,7 @@ func getMSTeamsIssuesPayload(p *api.IssuePayload) (*MSTeamsPayload, error) {
                                Targets: []MSTeamsActionTarget{
                                        {
                                                Os:  "default",
-                                               URI: p.Issue.URL,
+                                               URI: p.Issue.HTMLURL,
                                        },
                                },
                        },
index 11ad4c1b8bdf14fdf7f97875971def28d7059ecf..74361509d893f0a18c9e7f5ba35f2bc2fd3ae7d5 100644 (file)
@@ -158,7 +158,7 @@ func getSlackIssuesPayload(p *api.IssuePayload, slack *SlackMeta) (*SlackPayload
                pl.Attachments = []SlackAttachment{{
                        Color:     fmt.Sprintf("%x", color),
                        Title:     issueTitle,
-                       TitleLink: p.Issue.URL,
+                       TitleLink: p.Issue.HTMLURL,
                        Text:      attachmentText,
                }}
        }
index 45e84d3ed0fbae2b0e94756a264eeaa8c9965f5a..519a273b4e7fe451b6988922f08fb572720befac 100644 (file)
           "format": "date-time",
           "x-go-name": "Deadline"
         },
+        "html_url": {
+          "type": "string",
+          "x-go-name": "HTMLURL"
+        },
         "id": {
           "type": "integer",
           "format": "int64",