Notifications API: respond with updated notifications (#17064)

* notifications api: return updated notifications in response

* make generate-swagger

* openapi fix

Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
Norwin 2021-09-18 01:40:50 +02:00 committed by GitHub
parent ba2e600d17
commit 0ffad31b92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 37 additions and 23 deletions

View file

@ -71,7 +71,7 @@ func ReadThread(ctx *context.APIContext) {
// required: false
// responses:
// "205":
// "$ref": "#/responses/empty"
// "$ref": "#/responses/NotificationThread"
// "403":
// "$ref": "#/responses/forbidden"
// "404":
@ -87,12 +87,16 @@ func ReadThread(ctx *context.APIContext) {
targetStatus = models.NotificationStatusRead
}
err := models.SetNotificationStatus(n.ID, ctx.User, targetStatus)
notif, err := models.SetNotificationStatus(n.ID, ctx.User, targetStatus)
if err != nil {
ctx.InternalServerError(err)
return
}
ctx.Status(http.StatusResetContent)
if err = notif.LoadAttributes(); err != nil {
ctx.InternalServerError(err)
return
}
ctx.JSON(http.StatusResetContent, convert.ToNotificationThread(notif))
}
func getThread(ctx *context.APIContext) *models.Notification {