forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 1
/
notifications.go
30 lines (25 loc) · 757 Bytes
/
notifications.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// 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"
)
// 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:
// "204":
// description: No unread notification
// "302":
// description: Unread notification found
if models.UnreadAvailable(ctx.User) {
ctx.Status(http.StatusFound)
} else {
ctx.Status(http.StatusNoContent)
}
}