From 6c8ff32511f4295fa381a0144a7200e4eff273d6 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Tue, 15 Nov 2022 11:33:52 +0200 Subject: [PATCH] Add `updated_at` field to PullReview API object (#21812) * Closes #19997 Adds an `updated_at` time field to the `PullReview` API object to specify when the pull request review's state changed. Signed-off-by: Yarden Shoham Co-authored-by: Lunny Xiao --- modules/convert/pull_review.go | 1 + modules/structs/pull_review.go | 2 ++ templates/swagger/v1_json.tmpl | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/modules/convert/pull_review.go b/modules/convert/pull_review.go index 93ce20822..e8a543fea 100644 --- a/modules/convert/pull_review.go +++ b/modules/convert/pull_review.go @@ -39,6 +39,7 @@ func ToPullReview(ctx context.Context, r *issues_model.Review, doer *user_model. Dismissed: r.Dismissed, CodeCommentsCount: r.GetCodeCommentsCount(), Submitted: r.CreatedUnix.AsTime(), + Updated: r.UpdatedUnix.AsTime(), HTMLURL: r.HTMLURL(), HTMLPullURL: r.Issue.HTMLURL(), } diff --git a/modules/structs/pull_review.go b/modules/structs/pull_review.go index 7c9360a0c..ca2af4865 100644 --- a/modules/structs/pull_review.go +++ b/modules/structs/pull_review.go @@ -40,6 +40,8 @@ type PullReview struct { CodeCommentsCount int `json:"comments_count"` // swagger:strfmt date-time Submitted time.Time `json:"submitted_at"` + // swagger:strfmt date-time + Updated time.Time `json:"updated_at"` HTMLURL string `json:"html_url"` HTMLPullURL string `json:"pull_request_url"` diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 229e21906..fe3185ea7 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -17891,6 +17891,11 @@ "team": { "$ref": "#/definitions/Team" }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + }, "user": { "$ref": "#/definitions/User" }