Skip to content

Commit

Permalink
BEAKING: check return status based on struct not httpStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 committed Apr 9, 2020
1 parent 0be25e2 commit 533f52a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
13 changes: 2 additions & 11 deletions routers/api/v1/notify/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)})
}
3 changes: 0 additions & 3 deletions templates/swagger/v1_json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,6 @@
"responses": {
"200": {
"$ref": "#/responses/NotificationCount"
},
"204": {
"description": "No unread notification"
}
}
}
Expand Down

0 comments on commit 533f52a

Please sign in to comment.