diff options
| author | 2022-06-08 20:22:49 +0200 | |
|---|---|---|
| committer | 2022-06-08 20:22:49 +0200 | |
| commit | 6f6e89e2715c9ecbadda6b8dbe5227995348dae8 (patch) | |
| tree | da867633cdd72981460baf76615a81ab3390ce9c /internal/api/client/notification | |
| parent | [frontend] linkify header mascot+title (#633) (diff) | |
| download | gotosocial-6f6e89e2715c9ecbadda6b8dbe5227995348dae8.tar.xz | |
[feature] Add paging via `Link` header for notifications and account statuses (#629)
* test link headers
* page get account statuses properly
* page get notifications
* add util func for packaging timeline responses
* return timelined stuff from accountstatusesget
* rename timeline response
* use new convenience function
* go fmt
Diffstat (limited to 'internal/api/client/notification')
| -rw-r--r-- | internal/api/client/notification/notificationsget.go | 7 | 
1 files changed, 5 insertions, 2 deletions
| diff --git a/internal/api/client/notification/notificationsget.go b/internal/api/client/notification/notificationsget.go index 0a56ee80b..b6f7cdd01 100644 --- a/internal/api/client/notification/notificationsget.go +++ b/internal/api/client/notification/notificationsget.go @@ -74,12 +74,15 @@ func (m *Module) NotificationsGETHandler(c *gin.Context) {  		sinceID = sinceIDString  	} -	notifs, errWithCode := m.processor.NotificationsGet(c.Request.Context(), authed, limit, maxID, sinceID) +	resp, errWithCode := m.processor.NotificationsGet(c.Request.Context(), authed, limit, maxID, sinceID)  	if errWithCode != nil {  		l.Debugf("error processing notifications get: %s", errWithCode.Error())  		c.JSON(errWithCode.Code(), gin.H{"error": errWithCode.Safe()})  		return  	} -	c.JSON(http.StatusOK, notifs) +	if resp.LinkHeader != "" { +		c.Header("Link", resp.LinkHeader) +	} +	c.JSON(http.StatusOK, resp.Items)  } | 
