Add an updated_at field to the API call for issue's comment creation

The update date is used as the comment creation date, and is applied to
the issue as the update creation date.
This commit is contained in:
fluzz 2023-06-15 18:50:20 +02:00
parent 4926a5d7a2
commit 76c8faecdc
3 changed files with 13 additions and 0 deletions

View file

@ -28,6 +28,8 @@ type Comment struct {
type CreateIssueCommentOption struct {
// required:true
Body string `json:"body" binding:"Required"`
// swagger:strfmt date-time
Updated *time.Time `json:"updated_at"`
}
// EditIssueCommentOption options for editing a comment

View file

@ -362,6 +362,12 @@ func CreateIssueComment(ctx *context.APIContext) {
return
}
err = issue_service.SetIssueUpdateDate(ctx, issue, form.Updated, ctx.Doer)
if err != nil {
ctx.Error(http.StatusForbidden, "SetIssueUpdateDate", err)
return
}
comment, err := issue_service.CreateIssueComment(ctx, ctx.Doer, ctx.Repo.Repository, issue, form.Body, nil)
if err != nil {
ctx.Error(http.StatusInternalServerError, "CreateIssueComment", err)

View file

@ -17047,6 +17047,11 @@
"body": {
"type": "string",
"x-go-name": "Body"
},
"updated_at": {
"type": "string",
"format": "date-time",
"x-go-name": "Updated"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"