Repository navigation
feat: list a profile's followers and following in the API - #556
Merged
Merged
Conversation
This was referenced Oct 19, 2026
simonhamp
marked this pull request as ready for review
October 19, 2026 08:47
sheraz4196
approved these changes
Oct 19, 2026
GET /api/v1/users/{username}/followers and /following list people the
way the web's connections pages do: newest follow first, 30 a page.
A signed request also gets each person's lane, whether its user follows
them (is_followed) and whether they follow its user (follows_you).
Across a block a signed request gets user_blocked or user_unavailable,
as the profile does.
simonhamp
force-pushed
the
feat/api-follow-lists
branch
from
October 19, 2026 17:32
b9f73dd to
b33cdf2
Compare
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.
Lets the mobile app list a profile's followers and following. It follows #130, which added the signed API, and is one of a few small PRs for the endpoints the app (NativePHP/dev-null-app) uses on top of it.
Endpoints
GET /api/v1/users/{username}/followersGET /api/v1/users/{username}/followingLike the profile and its commits, they're public and sit in the optional-signature group. A signed request also gets each person's
lane,is_followed(the signed-in user follows them) andfollows_you(they follow the signed-in user). Across a block a signed request gets a403withuser_blockedoruser_unavailable, the same as the profile.What changed
Api\UserFollowersController@indexandApi\UserFollowingController@index, each with its ownListApiUser…Requestfor the block check.UserConnectionsQueryholds the order and the twowithExistsfor a signed-in viewer, shared by both controllers.UserResourcegainsfollows_youthroughwhenHas, next to the existingis_followed.Worth checking
follows.created_atthenusers.id, the same as the web. The tests page through 31 people and check there's no query per row.userwithuser_blocked, like the profile.The web has no way to remove one of your own followers, so there's no endpoint for that.
Testing
Everything CI runs passes on this branch locally: Pint, Rector, the JS lint, PHPStan, tsc, type coverage, and all 2,966 tests at 100% coverage.
The app's follower and following lists (NativePHP/dev-null-app#10) have been running against these endpoints on a phone.