Add stub endpoints for trends and suggestions#427
Merged
dahlia merged 5 commits intofedify-dev:mainfrom Apr 26, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
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/suggestionsstub route returning[]. - Add
/api/v2/suggestionsstub 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. |
Contributor
Author
|
Good call on the test coverage. I'll add a test for the stub endpoints to match the existing patterns. |
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
590feec to
ea924b7
Compare
Member
|
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. |
|
Thank you @dahlia an @vigneshakaviki - I've pulled this new update and verified it's fixed in the Test Flight Mastodon build. Very appreciated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
200with 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/tagsGET /api/v1/trends/statusesGET /api/v1/trends/linksGET /api/v1/suggestionsGET /api/v2/suggestionsThis follows the same pattern already used for
/api/v1/announcements.Testing
tsc— passesbiome check— passesRef #421