summaryrefslogtreecommitdiffstats
path: root/routers/api/v1
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-04-11 01:49:39 +0200
committerGitHub <noreply@github.com>2020-04-10 19:49:39 -0400
commit0dadea19bcc469937d0b2376db031a46cfcfb742 (patch)
tree302c8b72a3b76743ff0e4cfd806b3aca450ab434 /routers/api/v1
parentc97e9883801d28ca44b8b7049a4285c8d904eea8 (diff)
downloadgitea-0dadea19bcc469937d0b2376db031a46cfcfb742.tar.gz
gitea-0dadea19bcc469937d0b2376db031a46cfcfb742.zip
[Api] Check Notify (always return json) (#10059)
* BEAKING: check return status based on struct not httpStatus * update Tests * CI.restart()
Diffstat (limited to 'routers/api/v1')
-rw-r--r--routers/api/v1/notify/notifications.go13
1 files changed, 2 insertions, 11 deletions
diff --git a/routers/api/v1/notify/notifications.go b/routers/api/v1/notify/notifications.go
index 847fe3313e..71dd7d9492 100644
--- a/routers/api/v1/notify/notifications.go
+++ b/routers/api/v1/notify/notifications.go
@@ -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)})
}