Skip to content

[2.x] fix: send user slug, not username, for profile author filter - #4655

Merged
imorland merged 1 commit into
2.xfrom
im/profile-author-filter-slug-driver
May 12, 2026
Merged

[2.x] fix: send user slug, not username, for profile author filter#4655
imorland merged 1 commit into
2.xfrom
im/profile-author-filter-slug-driver

Conversation

@imorland

Copy link
Copy Markdown
Member

Summary

When a non-default user slug driver is active (e.g. IdWithDisplayName, id), the Discussions and Posts tabs on user profiles are empty, even though the count badges report the correct totals.

Root cause: DiscussionsUserPage, PostsUserPage, and SearchModal build filter[author] = user.username(). The server-side AuthorFilter resolves that value through the configured slug driver. Under IdWithDisplayName, a plain username does not parse as <id>-<name>, so the filter throws ModelNotFoundException, the slug is silently skipped, and the query becomes whereIn(..., []).

The existing slug-driver test (tests/integration/api/discussions/ListTest.php::author_filter_works_with_slug_driver) already pins the API contract: filter[author] takes whatever slug the active driver produces. This change brings the three frontend call sites in line with that contract.

Test plan

  • IdWithDisplayName driver: own profile and another user's profile both populate Discussions and Posts tabs.
  • id driver: same.
  • username driver (default): no regression on own or other profiles.
  • Search modal from /u/<slug>/posts: pre-fills the author filter correctly under each driver.
  • Browser console clean; ?filter[author]=… query string matches the active driver's slug.

Closes #4603

The server-side `author` filter resolves values through the active user
slug driver. When the driver is not the default `username` driver, sending
`user.username()` no longer matches and the filter resolves to no IDs,
producing empty discussion/post lists on user profiles.

Send `user.slug()` instead so the value round-trips through whichever
slug driver is configured.

Closes #4603
@imorland
imorland requested a review from a team as a code owner May 12, 2026 19:38
@imorland imorland modified the milestone: 2.0.0-rc.2 May 12, 2026
@imorland
imorland merged commit 4944206 into 2.x May 12, 2026
24 checks passed
@imorland
imorland deleted the im/profile-author-filter-slug-driver branch May 12, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2.0.0-rc.1] Nicknames slug driver causes profile discussions and posts lists to be empty

1 participant