Skip to content

[2.x] fix: use SlugManager in AuthorFilter to support custom slug drivers#4486

Merged
imorland merged 1 commit into2.xfrom
im/author-filter-slug-driver
Mar 22, 2026
Merged

[2.x] fix: use SlugManager in AuthorFilter to support custom slug drivers#4486
imorland merged 1 commit into2.xfrom
im/author-filter-slug-driver

Conversation

@imorland
Copy link
Copy Markdown
Member

Summary

  • Fixes [1.x & partially 2.x] Author Filter Incompatible in some cases #4360
  • AuthorFilter (discussions and posts) previously resolved users via UserRepository::getIdsForUsernames(), which only queries by the username column — ignoring the active user slug driver
  • Users with id or id_with_display_name slug drivers configured could not filter by author using the expected slug format
  • Both filters now use SlugManager::forResource(User::class)->fromSlug() so the active driver is respected; unresolvable slugs are silently skipped

Test plan

  • Existing author_filter_works and author_filter_works_negated tests still pass (username driver)
  • New author_filter_works_with_slug_driver data-provider tests cover username, id, and id_with_display_name drivers for both discussions and posts
  • New author_filter_negation_works_with_id_slug_driver tests cover negation with id driver for both discussions and posts
  • Manual: switch slug driver in admin, filter discussions/posts by author using the appropriate slug format

…rivers

Fixes #4360. The author filter previously used UserRepository::getIdsForUsernames()
which only matched by username, ignoring the active slug driver. Users using the
'id' or 'id_with_display_name' slug driver could not filter discussions or posts
by author. Now uses SlugManager::forResource(User::class)->fromSlug() so the
filter respects whatever slug driver is configured, with tests for all three
built-in drivers.
@imorland imorland changed the title fix(search): use SlugManager in AuthorFilter to support custom slug drivers [2.x] fix: use SlugManager in AuthorFilter to support custom slug drivers Mar 22, 2026
@imorland
Copy link
Copy Markdown
Member Author

@DavideIadeluca would this resolve the issue with the Author Filter extension? #4360

@DavideIadeluca
Copy link
Copy Markdown
Contributor

DavideIadeluca commented Mar 22, 2026

@DavideIadeluca would this resolve the issue with the Author Filter extension? #4360

Didn't test the PR but rom briefly glancing at it I think so!

@imorland imorland added this to the 2.0.0-beta.8 milestone Mar 22, 2026
@imorland imorland marked this pull request as ready for review March 22, 2026 18:09
@imorland imorland requested a review from a team as a code owner March 22, 2026 18:09
@imorland imorland merged commit 57ed2e4 into 2.x Mar 22, 2026
25 checks passed
@imorland imorland deleted the im/author-filter-slug-driver branch March 22, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[1.x & partially 2.x] Author Filter Incompatible in some cases

2 participants