Do not generate `rel=next` in the Link header when there are no more records
The issue was originally described in https://patch.cx/notice/A3InRXBfh6SMFMuZsW .
Currently Pleroma just generates rel=next
header regardless of whether there are any records after the current page, so the frontend can't know whether it should fetch the next page or not. Of course the frontend can compare if the number of posts is equal to the limit, and if not, assume the end of the timeline. However, this creates a false-positive when a user has limit*n posts and a false-negative when rendering one of the posts fails (because safe_render_many will just skip it and return the rest).
There are several ways I've thought of to determine if there are records after the current page:
- The easiest, but hacky ux-wise: Do what some frontends and mastodon backend currently do: compare the number of records returned by the database to the limit we specified and do not render
rel=next
only when the two are not equal. This however still retains the false-positive described above. - The most correct, but least performant: Do an additional query when
number of records == limit
to determine if there any records left. - Performant and correct ux-wise, but hacky code-wise: query minimal ids for timelines on first request to them and cache the results in ets
@lambadalambda @lanodan thoughts?
Edited by rinpatch