Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions modules/structs/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ type Issue struct {
Ref string `json:"ref"`
Labels []*Label `json:"labels"`
Milestone *Milestone `json:"milestone"`
Assignee *User `json:"assignee"`
Assignees []*User `json:"assignees"`
// deprecated
Assignee *User `json:"assignee"`
Assignees []*User `json:"assignees"`
// Whether the issue is open or closed
//
// type: string
Expand Down Expand Up @@ -83,7 +84,8 @@ type CreateIssueOption struct {
// required:true
Title string `json:"title" binding:"Required"`
Body string `json:"body"`
// username of assignee
Ref string `json:"ref"`
// deprecated
Assignee string `json:"assignee"`
Assignees []string `json:"assignees"`
// swagger:strfmt date-time
Expand All @@ -97,8 +99,10 @@ type CreateIssueOption struct {

// EditIssueOption options for editing an issue
type EditIssueOption struct {
Title string `json:"title"`
Body *string `json:"body"`
Title string `json:"title"`
Body *string `json:"body"`
Ref *string `json:"ref"`
// deprecated
Assignee *string `json:"assignee"`
Assignees []string `json:"assignees"`
Milestone *int64 `json:"milestone"`
Expand Down
8 changes: 8 additions & 0 deletions routers/api/v1/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
PosterID: ctx.User.ID,
Poster: ctx.User,
Content: form.Body,
Ref: form.Ref,
DeadlineUnix: deadlineUnix,
}

Expand Down Expand Up @@ -625,6 +626,13 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
if form.Body != nil {
issue.Content = *form.Body
}
if form.Ref != nil {
err = issue_service.ChangeIssueRef(issue, ctx.User, *form.Ref)
if err != nil {
ctx.Error(http.StatusInternalServerError, "UpdateRef", err)
return
}
}

// Update or remove the deadline, only if set and allowed
if (form.Deadline != nil || form.RemoveDeadline != nil) && canWrite {
Expand Down
11 changes: 10 additions & 1 deletion templates/swagger/v1_json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11937,7 +11937,7 @@
],
"properties": {
"assignee": {
"description": "username of assignee",
"description": "deprecated",
"type": "string",
"x-go-name": "Assignee"
},
Expand Down Expand Up @@ -11976,6 +11976,10 @@
"format": "int64",
"x-go-name": "Milestone"
},
"ref": {
"type": "string",
"x-go-name": "Ref"
},
"title": {
"type": "string",
"x-go-name": "Title"
Expand Down Expand Up @@ -12778,6 +12782,7 @@
"type": "object",
"properties": {
"assignee": {
"description": "deprecated",
"type": "string",
"x-go-name": "Assignee"
},
Expand All @@ -12802,6 +12807,10 @@
"format": "int64",
"x-go-name": "Milestone"
},
"ref": {
"type": "string",
"x-go-name": "Ref"
},
"state": {
"type": "string",
"x-go-name": "State"
Expand Down