diff options
author | 2023-05-04 12:27:24 +0200 | |
---|---|---|
committer | 2023-05-04 12:27:24 +0200 | |
commit | 4a012acd5255585045babfb38202e9df4bb1fdee (patch) | |
tree | cb8ed7d3fba01751de44fd96bdf905b967f93c7a /internal/api/client/notifications/notificationsget.go | |
parent | [bugfix] Fix invalid og:description on account w/ empty note (#1733) (diff) | |
download | gotosocial-4a012acd5255585045babfb38202e9df4bb1fdee.tar.xz |
[bugfix] Rework notifs to use min_id for paging up (#1734)
Diffstat (limited to 'internal/api/client/notifications/notificationsget.go')
-rw-r--r-- | internal/api/client/notifications/notificationsget.go | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/internal/api/client/notifications/notificationsget.go b/internal/api/client/notifications/notificationsget.go index adfc1bcc3..6ce8adcab 100644 --- a/internal/api/client/notifications/notificationsget.go +++ b/internal/api/client/notifications/notificationsget.go @@ -50,6 +50,29 @@ import ( // // parameters: // - +// name: max_id +// type: string +// description: >- +// Return only notifications *OLDER* than the given max notification ID. +// The notification with the specified ID will not be included in the response. +// in: query +// required: false +// - +// name: since_id +// type: string +// description: >- +// Return only notifications *newer* than the given since notification ID. +// The notification with the specified ID will not be included in the response. +// in: query +// - +// name: min_id +// type: string +// description: >- +// Return only notifications *immediately newer* than the given since notification ID. +// The notification with the specified ID will not be included in the response. +// in: query +// required: false +// - // name: limit // type: integer // description: Number of notifications to return. @@ -64,22 +87,6 @@ import ( // description: Array of types of notifications to exclude (follow, favourite, reblog, mention, poll, follow_request) // in: query // required: false -// - -// name: max_id -// type: string -// description: >- -// Return only notifications *OLDER* than the given max status ID. -// The status with the specified ID will not be included in the response. -// in: query -// required: false -// - -// name: since_id -// type: string -// description: |- -// Return only notifications *NEWER* than the given since status ID. -// The status with the specified ID will not be included in the response. -// in: query -// required: false // // security: // - OAuth2 Bearer: @@ -131,21 +138,15 @@ func (m *Module) NotificationsGETHandler(c *gin.Context) { limit = int(i) } - maxID := "" - maxIDString := c.Query(MaxIDKey) - if maxIDString != "" { - maxID = maxIDString - } - - sinceID := "" - sinceIDString := c.Query(SinceIDKey) - if sinceIDString != "" { - sinceID = sinceIDString - } - - excludeTypes := c.QueryArray(ExcludeTypesKey) - - resp, errWithCode := m.processor.NotificationsGet(c.Request.Context(), authed, excludeTypes, limit, maxID, sinceID) + resp, errWithCode := m.processor.NotificationsGet( + c.Request.Context(), + authed, + c.Query(MaxIDKey), + c.Query(SinceIDKey), + c.Query(MinIDKey), + limit, + c.QueryArray(ExcludeTypesKey), + ) if errWithCode != nil { apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1) return |