@@ -11,6 +11,7 @@ import (
11
11
"code.gitea.io/gitea/models"
12
12
"code.gitea.io/gitea/modules/context"
13
13
"code.gitea.io/gitea/modules/convert"
14
+ "code.gitea.io/gitea/modules/structs"
14
15
)
15
16
16
17
// ListNotifications list users's notification threads
@@ -125,7 +126,7 @@ func ReadNotifications(ctx *context.APIContext) {
125
126
// required: false
126
127
// responses:
127
128
// "205":
128
- // "$ref": "#/responses/empty "
129
+ // "$ref": "#/responses/NotificationThreadList "
129
130
130
131
lastRead := int64 (0 )
131
132
qLastRead := ctx .FormTrim ("last_read_at" )
@@ -158,14 +159,17 @@ func ReadNotifications(ctx *context.APIContext) {
158
159
targetStatus = models .NotificationStatusRead
159
160
}
160
161
162
+ changed := make ([]* structs.NotificationThread , 0 , len (nl ))
163
+
161
164
for _ , n := range nl {
162
- err := models .SetNotificationStatus (n .ID , ctx .User , targetStatus )
165
+ notif , err := models .SetNotificationStatus (n .ID , ctx .User , targetStatus )
163
166
if err != nil {
164
167
ctx .InternalServerError (err )
165
168
return
166
169
}
167
- ctx .Status (http .StatusResetContent )
170
+ _ = notif .LoadAttributes ()
171
+ changed = append (changed , convert .ToNotificationThread (notif ))
168
172
}
169
173
170
- ctx .Status (http .StatusResetContent )
174
+ ctx .JSON (http .StatusResetContent , changed )
171
175
}
0 commit comments