mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-18 08:08:31 +00:00
Extend Notifications API and return pinned notifications by default (#12164)
* Extend notifications API and return pinned notifications in notifications list Signed-off-by: Andrew Thornton <art27@cantab.net> * fix swagger Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix swagger again Signed-off-by: Andrew Thornton <art27@cantab.net> * fix test Signed-off-by: Andrew Thornton <art27@cantab.net> * remove spurious debugs * as per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net> * Update models/notification.go * as per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
d08996c7b9
commit
63591016b3
7 changed files with 206 additions and 24 deletions
|
@ -62,6 +62,12 @@ func ReadThread(ctx *context.APIContext) {
|
|||
// description: id of notification thread
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: to-status
|
||||
// in: query
|
||||
// description: Status to mark notifications as
|
||||
// type: string
|
||||
// default: read
|
||||
// required: false
|
||||
// responses:
|
||||
// "205":
|
||||
// "$ref": "#/responses/empty"
|
||||
|
@ -75,7 +81,12 @@ func ReadThread(ctx *context.APIContext) {
|
|||
return
|
||||
}
|
||||
|
||||
err := models.SetNotificationStatus(n.ID, ctx.User, models.NotificationStatusRead)
|
||||
targetStatus := statusStringToNotificationStatus(ctx.Query("to-status"))
|
||||
if targetStatus == 0 {
|
||||
targetStatus = models.NotificationStatusRead
|
||||
}
|
||||
|
||||
err := models.SetNotificationStatus(n.ID, ctx.User, targetStatus)
|
||||
if err != nil {
|
||||
ctx.InternalServerError(err)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue