Skip to content

Add stub endpoints for trends and suggestions#427

Merged
dahlia merged 5 commits intofedify-dev:mainfrom
vigneshakaviki:fix/stub-trends-and-suggestions-endpoints
Apr 26, 2026
Merged

Add stub endpoints for trends and suggestions#427
dahlia merged 5 commits intofedify-dev:mainfrom
vigneshakaviki:fix/stub-trends-and-suggestions-endpoints

Conversation

@vigneshakaviki
Copy link
Copy Markdown
Contributor

What's happening

The official Mastodon iOS app (and likely other clients) hits several endpoints that Hollo doesn't implement yet — /api/v1/trends/* and /api/v{1,2}/suggestions. Right now these return 404, which causes the iOS app to throw "The data couldn't be read because it is missing" errors when you open the Search tab or navigate around.

Mastodon servers that simply don't have any trending data or suggestions still return 200 with an empty array — clients depend on this.

What this changes

Added stub endpoints that return []:

  • GET /api/v1/trends (alias for /trends/tags)
  • GET /api/v1/trends/tags
  • GET /api/v1/trends/statuses
  • GET /api/v1/trends/links
  • GET /api/v1/suggestions
  • GET /api/v2/suggestions

This follows the same pattern already used for /api/v1/announcements.

Testing

Ref #421

@dahlia dahlia added this to the Hollo 0.8 milestone Apr 13, 2026
@dahlia dahlia added the bug Something isn't working label Apr 13, 2026
@dahlia dahlia requested a review from Copilot April 13, 2026 03:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Mastodon-compatible stub endpoints for trends and account suggestions so clients (notably the official Mastodon iOS app) receive 200 with an empty array instead of 404, avoiding client-side parsing errors.

Changes:

  • Add /api/v1/trends, /api/v1/trends/{tags,statuses,links} stub routes returning [].
  • Add /api/v1/suggestions stub route returning [].
  • Add /api/v2/suggestions stub route returning [].

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/api/v1/index.ts Adds stub /trends/*, /trends, and /suggestions endpoints returning empty arrays.
src/api/v2/index.ts Adds stub /suggestions endpoint returning an empty array.

Comment thread src/api/v2/index.ts Outdated
@vigneshakaviki
Copy link
Copy Markdown
Contributor Author

Good call on the test coverage. I'll add a test for the stub endpoints to match the existing patterns.

@dahlia dahlia linked an issue Apr 26, 2026 that may be closed by this pull request
@dahlia dahlia self-assigned this Apr 26, 2026
vigneshakaviki and others added 5 commits April 27, 2026 00:19
Mastodon clients (including the official iOS app) expect the trends
and suggestions endpoints to return empty arrays rather than 404.
Without these stubs, the iOS app throws "The data couldn't be read"
errors when navigating to Search or certain timelines.

Added endpoints:
- GET /api/v1/trends (alias for /trends/tags)
- GET /api/v1/trends/tags
- GET /api/v1/trends/statuses
- GET /api/v1/trends/links
- GET /api/v1/suggestions
- GET /api/v2/suggestions

All return empty JSON arrays for now, matching the behavior of
Mastodon instances that have no trending data or suggestions.

Ref fedify-dev#421
Match Mastodon's suggestions API contract by requiring a user token
with account read access before returning the empty stub response.

fedify-dev#421

Assisted-by: OpenCode:gpt-5.5
Add regression coverage for the trends stubs and for suggestions
requiring a readable user token before returning an empty response.

fedify-dev#421

Assisted-by: OpenCode:gpt-5.5
Add a regression test for home timelines returning quote posts in the
Mastodon Quote entity shape expected by current Mastodon clients.

fedify-dev#421

Assisted-by: OpenCode:gpt-5.5
Note the Mastodon-compatible trends and suggestions stub endpoints in
the changelog so the client compatibility fix is visible in the next
release notes.

fedify-dev#421
fedify-dev#427

Assisted-by: OpenCode:gpt-5.5
@dahlia dahlia force-pushed the fix/stub-trends-and-suggestions-endpoints branch from 590feec to ea924b7 Compare April 26, 2026 15:34
@dahlia dahlia merged commit 651f3ac into fedify-dev:main Apr 26, 2026
2 checks passed
@dahlia
Copy link
Copy Markdown
Member

dahlia commented Apr 26, 2026

This fix will be shipped with the next minor release, Hollo 0.8.0. If you'd like to try it before then, you can use the prerelease build 0.8.0-dev.388.

@jeffsikes
Copy link
Copy Markdown

Thank you @dahlia an @vigneshakaviki - I've pulled this new update and verified it's fixed in the Test Flight Mastodon build. Very appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Official Mastodon iOS App Throws Errors on Local and Following Tabs

4 participants