2020-01-14 15:37:19 +00:00
|
|
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package notify
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/models"
|
|
|
|
"code.gitea.io/gitea/modules/context"
|
|
|
|
api "code.gitea.io/gitea/modules/structs"
|
|
|
|
)
|
|
|
|
|
|
|
|
// NewAvailable check if unread notifications exist
|
|
|
|
func NewAvailable(ctx *context.APIContext) {
|
|
|
|
// swagger:operation GET /notifications/new notification notifyNewAvailable
|
|
|
|
// ---
|
|
|
|
// summary: Check if unread notifications exist
|
|
|
|
// responses:
|
|
|
|
// "200":
|
2020-04-10 23:49:39 +00:00
|
|
|
// "$ref": "#/responses/NotificationCount"
|
|
|
|
ctx.JSON(http.StatusOK, api.NotificationCount{New: models.CountUnread(ctx.User)})
|
2020-01-14 15:37:19 +00:00
|
|
|
}
|