MastoAPI: Follows/follower endpoints return wrong Link header (develop)
Eg, visit here and scroll to the bottom: https://soap.shitposter.club/@MarioBot/followers It breaks.
Request like this doesn't work: https://shitposter.club/api/v1/accounts/9s99Hq44Cnv8PKBwWG/followers?id=9s99Hq44Cnv8PKBwWG&limit=20&max_id=9uTsLbPZCPtDMw33IG
400 error: {"error":"Unexpected field: id.","errors":[{"message":"Unexpected field: id","source":{"pointer":"/id"},"title":"Invalid value"}]}
Oh, the request has an unnecessary extra id
parameter. It's fine, MastoAPI doesn't require that anyway.
But the request URL for pagination is coming from the Pleroma backend, returned by the Link header. Soapbox FE is just paginating what Pleroma BE tells it to. Response Link header:
link: <https://shitposter.club/api/v1/accounts/9s99Hq44Cnv8PKBwWG/followers?id=9s99Hq44Cnv8PKBwWG&limit=20&max_id=9uTsLbPZCPtDMw33IG>; rel="next", <https://shitposter.club/api/v1/accounts/9s99Hq44Cnv8PKBwWG/followers?id=9s99Hq44Cnv8PKBwWG&limit=20&min_id=9wnBDuRM1IL1KV7QVU>; rel="prev"
You can see, it has the id
field which is invalid.
The ID is being set here: https://git.pleroma.social/pleroma/pleroma/-/blob/develop/lib/pleroma/web/controller_helper.ex#L71
From a commit called "ControllerHelper: Always return id field." (lol)
So I dunno what the solution is. Strip the ID field from the follower/following controllers specifically?
Related: soapbox-pub/soapbox-fe#229