1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 10:18:38 +00:00

[Api] Check Notify (always return json) (#10059)

* BEAKING: check return status based on struct not httpStatus

* update Tests

* CI.restart()
This commit is contained in:
6543
2020-04-11 01:49:39 +02:00
committed by GitHub
parent c97e988380
commit 0dadea19bc
3 changed files with 11 additions and 15 deletions

View File

@@ -19,15 +19,6 @@ func NewAvailable(ctx *context.APIContext) {
// summary: Check if unread notifications exist
// responses:
// "200":
// "$ref": "#/responses/NotificationCount"
// "204":
// description: No unread notification
count := models.CountUnread(ctx.User)
if count > 0 {
ctx.JSON(http.StatusOK, api.NotificationCount{New: count})
} else {
ctx.Status(http.StatusNoContent)
}
// "$ref": "#/responses/NotificationCount"
ctx.JSON(http.StatusOK, api.NotificationCount{New: models.CountUnread(ctx.User)})
}