Skip to content

Commit

Permalink
[API] Add Ref to Issue (#13946)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
zeripath committed Dec 13, 2020
1 parent cf6f8b2 commit 825efa2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/convert/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions modules/migrations/base/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Issue struct {
PosterEmail string
Title string
Content string
Ref string
Milestone string
State string // closed, open
IsLocked bool
Expand Down
1 change: 1 addition & 0 deletions modules/migrations/gitea_uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions modules/structs/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
4 changes: 4 additions & 0 deletions templates/swagger/v1_json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -13831,6 +13831,10 @@
"pull_request": {
"$ref": "#/definitions/PullRequestMeta"
},
"ref": {
"type": "string",
"x-go-name": "Ref"
},
"repository": {
"$ref": "#/definitions/RepositoryMeta"
},
Expand Down

0 comments on commit 825efa2

Please sign in to comment.