]> source.dussan.org Git - gitea.git/commitdiff
[API] Add Ref to Issue (#13946)
authorzeripath <art27@cantab.net>
Sun, 13 Dec 2020 11:34:11 +0000 (11:34 +0000)
committerGitHub <noreply@github.com>
Sun, 13 Dec 2020 11:34:11 +0000 (11:34 +0000)
* Add Ref to api.Issue

This PR adds Ref to api.Issue and adds the backend parts to the migrator.

Fix #13918

Signed-off-by: Andrew Thornton <art27@cantab.net>
modules/convert/issue.go
modules/migrations/base/issue.go
modules/migrations/gitea_uploader.go
modules/structs/issue.go
templates/swagger/v1_json.tmpl

index f34656b47c1c7ca041b57e3bb92b4358c2367e27..36446da2d160ef637e1455e0e7a540cf941c3307 100644 (file)
@@ -34,6 +34,7 @@ func ToAPIIssue(issue *models.Issue) *api.Issue {
                Poster:   ToUser(issue.Poster, false, false),
                Title:    issue.Title,
                Body:     issue.Content,
+               Ref:      issue.Ref,
                Labels:   ToLabelList(issue.Labels),
                State:    issue.State(),
                IsLocked: issue.IsLocked,
index b9625a23f6cd61760dbdffe50334c707efb7ce03..f9dc8b93feecda95c6be8de3b2b5ebb1ccc4d649 100644 (file)
@@ -15,6 +15,7 @@ type Issue struct {
        PosterEmail string
        Title       string
        Content     string
+       Ref         string
        Milestone   string
        State       string // closed, open
        IsLocked    bool
index 2cb19685fcb9efb74027677aab905e2e367041e4..20d7d81ae1e84c2b8ea098752c159de8e057ec09 100644 (file)
@@ -333,6 +333,7 @@ func (g *GiteaLocalUploader) CreateIssues(issues ...*base.Issue) error {
                        Index:       issue.Number,
                        Title:       issue.Title,
                        Content:     issue.Content,
+                       Ref:         issue.Ref,
                        IsClosed:    issue.State == "closed",
                        IsLocked:    issue.IsLocked,
                        MilestoneID: milestoneID,
index 54b0f31d8a5b388d37b1c5886b2189e91eb54379..06ad2de3228410e4b6ecf8d32ba31663f9223f4b 100644 (file)
@@ -47,6 +47,7 @@ type Issue struct {
        OriginalAuthorID int64      `json:"original_author_id"`
        Title            string     `json:"title"`
        Body             string     `json:"body"`
+       Ref              string     `json:"ref"`
        Labels           []*Label   `json:"labels"`
        Milestone        *Milestone `json:"milestone"`
        Assignee         *User      `json:"assignee"`
index bf8467ff2743e18df6cd3ab5765327ada089218f..e77651b15eed7d4a8c7d4427f29f696fc9728c83 100644 (file)
         "pull_request": {
           "$ref": "#/definitions/PullRequestMeta"
         },
+        "ref": {
+          "type": "string",
+          "x-go-name": "Ref"
+        },
         "repository": {
           "$ref": "#/definitions/RepositoryMeta"
         },