Skip to content

Commit

Permalink
ensure that the closed_at is set for closed
Browse files Browse the repository at this point in the history
right now the `closed_at` field for json responses is not filled during
the `APIIssue` creation for api responses.

For a closed issue you get a result like:
```json
"state":"open","comments":0,"created_at":"2018-11-29T16:39:24+01:00",
"updated_at":"2018-11-30T10:49:19+01:00","closed_at":null,
"due_date":null,"pull_request":null}
```
which has no information about the closing date. (which exists in the
db and ui)
with this PR the result changes to this:

```json
:null,"assignee":null,"assignees":null,
"state":"closed",
"comments":0,"created_at":"2018-11-29T16:43:05+01:00",
"updated_at":"2018-12-02T19:17:05+01:00",
"closed_at":"2018-12-02T19:17:05+01:00",
"due_date":null,"pull_request":null}
```

fixes: #5446
Signed-off-by: Roman <romaaan.git@gmail.com>
  • Loading branch information
romankl authored and r-52 committed Dec 2, 2018
1 parent 328e38e commit 8fc4d00
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions models/issue.go
Expand Up @@ -325,6 +325,10 @@ func (issue *Issue) APIFormat() *api.Issue {
Updated: issue.UpdatedUnix.AsTime(),
}

if issue.ClosedUnix != 0 {
apiIssue.Closed = issue.ClosedUnix.AsTimePtr()
}

if issue.Milestone != nil {
apiIssue.Milestone = issue.Milestone.APIFormat()
}
Expand Down

0 comments on commit 8fc4d00

Please sign in to comment.