You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
708 B

  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package notify
  5. import (
  6. "net/http"
  7. "code.gitea.io/gitea/models"
  8. "code.gitea.io/gitea/modules/context"
  9. api "code.gitea.io/gitea/modules/structs"
  10. )
  11. // NewAvailable check if unread notifications exist
  12. func NewAvailable(ctx *context.APIContext) {
  13. // swagger:operation GET /notifications/new notification notifyNewAvailable
  14. // ---
  15. // summary: Check if unread notifications exist
  16. // responses:
  17. // "200":
  18. // "$ref": "#/responses/NotificationCount"
  19. ctx.JSON(http.StatusOK, api.NotificationCount{New: models.CountUnread(ctx.User)})
  20. }