mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-28 09:21:13 -05:00
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:
parent
4926a5d7a2
commit
76c8faecdc
3 changed files with 13 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
5
templates/swagger/v1_json.tmpl
generated
5
templates/swagger/v1_json.tmpl
generated
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue