@@ -11,6 +11,7 @@ import (
1111 "code.gitea.io/gitea/models"
1212 "code.gitea.io/gitea/modules/context"
1313 "code.gitea.io/gitea/modules/convert"
14+ "code.gitea.io/gitea/modules/structs"
1415)
1516
1617// ListNotifications list users's notification threads
@@ -125,7 +126,7 @@ func ReadNotifications(ctx *context.APIContext) {
125126 // required: false
126127 // responses:
127128 // "205":
128- // "$ref": "#/responses/empty "
129+ // "$ref": "#/responses/NotificationThreadList "
129130
130131 lastRead := int64 (0 )
131132 qLastRead := ctx .FormTrim ("last_read_at" )
@@ -158,14 +159,17 @@ func ReadNotifications(ctx *context.APIContext) {
158159 targetStatus = models .NotificationStatusRead
159160 }
160161
162+ changed := make ([]* structs.NotificationThread , 0 , len (nl ))
163+
161164 for _ , n := range nl {
162- err := models .SetNotificationStatus (n .ID , ctx .User , targetStatus )
165+ notif , err := models .SetNotificationStatus (n .ID , ctx .User , targetStatus )
163166 if err != nil {
164167 ctx .InternalServerError (err )
165168 return
166169 }
167- ctx .Status (http .StatusResetContent )
170+ _ = notif .LoadAttributes ()
171+ changed = append (changed , convert .ToNotificationThread (notif ))
168172 }
169173
170- ctx .Status (http .StatusResetContent )
174+ ctx .JSON (http .StatusResetContent , changed )
171175}
0 commit comments