Skip to content

[1.x] feat: add Followers page to user profiles#49

Merged
imorland merged 2 commits into1.xfrom
pr-46-followers
Feb 21, 2026
Merged

[1.x] feat: add Followers page to user profiles#49
imorland merged 2 commits into1.xfrom
pr-46-followers

Conversation

@imorland
Copy link
Owner

Closes #46.

This supersedes #46 (originally authored by @BHZoon), rebased onto 1.x with the following fixes applied during review:

Changes from original PR

Bug fixes

  • FollowersPage and FollowingPage now correctly load the user from the route :username param via a show() override, instead of hardcoding app.session.user — pages work for any user profile when visited directly by URL
  • Added null guard on this.user in navItems extend

Behaviour

  • "Followers" nav link now appears on any user's profile (it's public info), not just the logged-in user's own profile
  • "Following" nav link remains restricted to own profile (it contains follow-level controls)

Performance

  • Removed actor.followedBy from ShowForumController includes — was loading the full followers list on every single page load
  • Removed followedBy from CurrentUserSerializer (not needed in the boot payload)
  • Removed followedBy from ListUsersController includes (unused there)
  • Removed redundant $data->load('followedBy') from LoadRelations.php; the addInclude extender on ShowUserController already handles this

Locale

  • Moved followers_link key from profile_page to forum top-level, consistent with the existing profile_link key

Tests

  • Added FollowedByTest with 3 integration tests:
    • followedBy relation is included when viewing another user's profile
    • followedBy relation is included when viewing own profile
    • followedBy is not included in the forum boot response (regression guard for the perf fix)

Test results

All 11 tests pass.

🤖 Generated with Claude Code

BHZoon and others added 2 commits February 21, 2026 20:16
- Fix FollowersPage and FollowingPage to load the user from the route
  username param via show() override, instead of hardcoding
  app.session.user — pages now work correctly for any user profile
  when visited directly by URL

- Show "Followers" nav link on any user profile (public info);
  keep "Following" nav link restricted to own profile (contains
  follow-level controls). Guard against null this.user in navItems.

- Remove actor.followedBy from ShowForumController includes to avoid
  eagerly loading the full followers list on every page load

- Remove followedBy from CurrentUserSerializer (not needed in boot
  payload) and from ListUsersController includes

- Remove redundant $data->load('followedBy') from LoadRelations.php;
  the addInclude extender on ShowUserController already handles this

- Move followers_link locale key from profile_page to forum top-level,
  consistent with profile_link

- Add integration tests for followedBy: included on ShowUserController,
  not included in forum boot response

- Rebase onto 1.x

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@imorland imorland changed the title feat: add Followers page to user profiles [1.x] feat: add Followers page to user profiles Feb 21, 2026
imorland added a commit that referenced this pull request Feb 21, 2026
Closes #46 (2.x port of #49).

**New features**
- New `/u/:username/followers` route showing who follows a given user
- "Followers" nav link appears on any user's profile (public information)
- "Following" nav link remains restricted to the logged-in user's own profile

**Bug fixes**
- `FollowingPage` (formerly `ProfilePage`) now correctly loads the user
  via `loadUser(m.route.param('username'))` + `show()` override, instead
  of hardcoding `app.session.user` — the page now works when visited
  directly by URL for any user
- Added null guard on `this.user` in `navItems` extend

**Performance**
- Removed `followedBy` from `Index` endpoint default includes — was
  loading the full followers list for every user in search/list results

**Refactoring**
- `ProfilePage` renamed to `FollowingPage` for clarity
- `FollowedUserListItem` renamed to `UserListItem` (now shared between
  both FollowingPage and FollowersPage)

**Locale**
- Added `followers_link` key to `forum` top-level (consistent with
  existing `profile_link`)
- Added `profile_page.no_followers` placeholder string

**Tests**
- Added `FollowedByTest` with 3 integration tests:
  - `followedBy` relation is included when viewing another user's profile
  - `followedBy` relation is included when viewing own profile
  - `followedBy` is NOT included in the forum boot response (regression
    guard for the perf fix)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@imorland imorland merged commit 98844f7 into 1.x Feb 21, 2026
6 checks passed
@imorland imorland deleted the pr-46-followers branch February 21, 2026 21:11
imorland added a commit that referenced this pull request Feb 21, 2026
* feat: add Followers page to user profiles

Closes #46 (2.x port of #49).

**New features**
- New `/u/:username/followers` route showing who follows a given user
- "Followers" nav link appears on any user's profile (public information)
- "Following" nav link remains restricted to the logged-in user's own profile

**Bug fixes**
- `FollowingPage` (formerly `ProfilePage`) now correctly loads the user
  via `loadUser(m.route.param('username'))` + `show()` override, instead
  of hardcoding `app.session.user` — the page now works when visited
  directly by URL for any user
- Added null guard on `this.user` in `navItems` extend

**Performance**
- Removed `followedBy` from `Index` endpoint default includes — was
  loading the full followers list for every user in search/list results

**Refactoring**
- `ProfilePage` renamed to `FollowingPage` for clarity
- `FollowedUserListItem` renamed to `UserListItem` (now shared between
  both FollowingPage and FollowersPage)

**Locale**
- Added `followers_link` key to `forum` top-level (consistent with
  existing `profile_link`)
- Added `profile_page.no_followers` placeholder string

**Tests**
- Added `FollowedByTest` with 3 integration tests:
  - `followedBy` relation is included when viewing another user's profile
  - `followedBy` relation is included when viewing own profile
  - `followedBy` is NOT included in the forum boot response (regression
    guard for the perf fix)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: add followedBy to User type shims

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants