Skip to content

Support gap-loading for timelines (SubwayTooter compatibility) #479

@ntsklab

Description

@ntsklab

Description

Currently, when viewing Hollo timelines using certain Mastodon clients like SubwayTooter, the "gap-loading" feature (fetching missing posts between already loaded posts) does not work correctly.

I tested this in my local fork and confirmed that applying the following changes makes gap-loading work properly. I propose incorporating these changes to improve overall usability.

Note on AI Usage:
The code for these changes was generated with the assistance of AI. Because of this, I am not entirely sure if it is the most accurate or optimal approach for the Hollo codebase. I would greatly appreciate it if the maintainers could review the implementation.

Proposed Changes

  1. Mastodon-compliant min_id handling for timelines:

    • Fixed the min_id behavior in timeline endpoints (/api/v1/timelines/home, /public, /list/:list_id, /tag/:hashtag) to match Mastodon's pagination logic.
    • When min_id is provided, the query now fetches the posts immediately above the cursor (by switching ORDER BY to ASC and then reversing the results back to DESC). This allows gap loading to properly converge when the gap is larger than the limit.
    • When both min_id and since_id are provided, the API now ignores since_id (matching Mastodon's behavior).
  2. Restored timeline pagination links (Link headers):

    • Fixed the timeline endpoints to properly generate and expose the prev/next Link headers required for gap-loading navigation.

Expected Behavior

When fetching timelines from clients that support gap-loading (such as SubwayTooter), users should be able to load missing posts continuously without skipping any items between older and newer posts.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions