diff options
| author | 2024-11-25 15:33:21 +0000 | |
|---|---|---|
| committer | 2024-11-25 15:33:21 +0000 | |
| commit | a444adee979375ed5d7af38346029a3d90bc77eb (patch) | |
| tree | 8ff7fedc012bdf242451c4d2c4a22c0a714b9b8f /internal/api/client | |
| parent | [chore] Bump tooling versions, bump go -> v1.23.0 (#3258) (diff) | |
| download | gotosocial-a444adee979375ed5d7af38346029a3d90bc77eb.tar.xz | |
[bugfix] notification types missing from link header (#3571)
* ensure notification types get included in link header query for notifications
* fix type query keys
Diffstat (limited to 'internal/api/client')
| -rw-r--r-- | internal/api/client/notifications/notificationsget.go | 30 | 
1 files changed, 12 insertions, 18 deletions
diff --git a/internal/api/client/notifications/notificationsget.go b/internal/api/client/notifications/notificationsget.go index cc3e5bdb7..841768c63 100644 --- a/internal/api/client/notifications/notificationsget.go +++ b/internal/api/client/notifications/notificationsget.go @@ -18,14 +18,13 @@  package notifications  import ( -	"fmt"  	"net/http" -	"strconv"  	"github.com/gin-gonic/gin"  	apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util"  	"github.com/superseriousbusiness/gotosocial/internal/gtserror"  	"github.com/superseriousbusiness/gotosocial/internal/oauth" +	"github.com/superseriousbusiness/gotosocial/internal/paging"  )  // NotificationsGETHandler swagger:operation GET /api/v1/notifications notifications @@ -152,18 +151,6 @@ func (m *Module) NotificationsGETHandler(c *gin.Context) {  		return  	} -	limit := 20 -	limitString := c.Query(LimitKey) -	if limitString != "" { -		i, err := strconv.ParseInt(limitString, 10, 32) -		if err != nil { -			err := fmt.Errorf("error parsing %s: %s", LimitKey, err) -			apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGetV1) -			return -		} -		limit = int(i) -	} -  	types, errWithCode := apiutil.ParseNotificationTypes(c.QueryArray(TypesKey))  	if errWithCode != nil {  		apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1) @@ -176,13 +163,20 @@ func (m *Module) NotificationsGETHandler(c *gin.Context) {  		return  	} +	page, errWithCode := paging.ParseIDPage(c, +		1,  // min limit +		80, // max limit +		20, // no limit +	) +	if errWithCode != nil { +		apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1) +		return +	} +  	resp, errWithCode := m.processor.Timeline().NotificationsGet(  		c.Request.Context(),  		authed, -		c.Query(MaxIDKey), -		c.Query(SinceIDKey), -		c.Query(MinIDKey), -		limit, +		page,  		types,  		exclTypes,  	)  | 
