summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/notify/repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/notify/repo.go')
-rw-r--r--routers/api/v1/notify/repo.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/routers/api/v1/notify/repo.go b/routers/api/v1/notify/repo.go
index 1a36642b6a..382d221b85 100644
--- a/routers/api/v1/notify/repo.go
+++ b/routers/api/v1/notify/repo.go
@@ -13,6 +13,7 @@ import (
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/modules/structs"
)
func statusStringToNotificationStatus(status string) models.NotificationStatus {
@@ -176,7 +177,7 @@ func ReadRepoNotifications(ctx *context.APIContext) {
// required: false
// responses:
// "205":
- // "$ref": "#/responses/empty"
+ // "$ref": "#/responses/NotificationThreadList"
lastRead := int64(0)
qLastRead := ctx.FormTrim("last_read_at")
@@ -213,14 +214,16 @@ func ReadRepoNotifications(ctx *context.APIContext) {
targetStatus = models.NotificationStatusRead
}
+ changed := make([]*structs.NotificationThread, len(nl))
+
for _, n := range nl {
- err := models.SetNotificationStatus(n.ID, ctx.User, targetStatus)
+ notif, err := models.SetNotificationStatus(n.ID, ctx.User, targetStatus)
if err != nil {
ctx.InternalServerError(err)
return
}
- ctx.Status(http.StatusResetContent)
+ _ = notif.LoadAttributes()
+ changed = append(changed, convert.ToNotificationThread(notif))
}
-
- ctx.Status(http.StatusResetContent)
+ ctx.JSON(http.StatusResetContent, changed)
}