Skip to content

feat: list a profile's followers and following in the API - #556

Merged
xHeaven merged 1 commit into
dev-null-sh:productionfrom
simonhamp:feat/api-follow-lists
Oct 19, 2026
Merged

xHeaven merged 1 commit into
dev-null-sh:productionfrom
simonhamp:feat/api-follow-lists

Conversation

@simonhamp

@simonhamp simonhamp commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

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

Request Answer
GET /api/v1/users/{username}/followers The people following the user, newest follow first, 30 a page with a cursor
GET /api/v1/users/{username}/following The people the user follows, the same way

Like 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) and follows_you (they follow the signed-in user). Across a block a signed request gets a 403 with user_blocked or user_unavailable, the same as the profile.

What changed

  • Api\UserFollowersController@index and Api\UserFollowingController@index, each with its own ListApiUser…Request for the block check.
  • UserConnectionsQuery holds the order and the two withExists for a signed-in viewer, shared by both controllers.
  • UserResource gains follows_you through whenHas, next to the existing is_followed.
  • The README lists both endpoints.

Worth checking

  • The paging orders by follows.created_at then users.id, the same as the web. The tests page through 31 people and check there's no query per row.
  • Rebased onto production after feat: mute and block people from the API #555 merged, so both block checks now send the blocked user with user_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.

Copilot AI balanced review requested due to automatic review settings October 19, 2026 06:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI balanced review requested due to automatic review settings October 19, 2026 16:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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
simonhamp force-pushed the feat/api-follow-lists branch from b9f73dd to b33cdf2 Compare October 19, 2026 17:32
Copilot AI balanced review requested due to automatic review settings October 19, 2026 17:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@xHeaven
xHeaven merged commit 7f3e187 into dev-null-sh:production Oct 19, 2026
5 of 6 checks passed
@simonhamp
simonhamp deleted the feat/api-follow-lists branch October 19, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants