[2.x] fix: use SlugManager in AuthorFilter to support custom slug drivers#4486
Merged
[2.x] fix: use SlugManager in AuthorFilter to support custom slug drivers#4486
Conversation
…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.
Member
Author
|
@DavideIadeluca would this resolve the issue with the |
Contributor
Didn't test the PR but rom briefly glancing at it I think so! |
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.
Summary
AuthorFilter(discussions and posts) previously resolved users viaUserRepository::getIdsForUsernames(), which only queries by theusernamecolumn — ignoring the active user slug driveridorid_with_display_nameslug drivers configured could not filter by author using the expected slug formatSlugManager::forResource(User::class)->fromSlug()so the active driver is respected; unresolvable slugs are silently skippedTest plan
author_filter_worksandauthor_filter_works_negatedtests still pass (username driver)author_filter_works_with_slug_driverdata-provider tests coverusername,id, andid_with_display_namedrivers for both discussions and postsauthor_filter_negation_works_with_id_slug_drivertests cover negation withiddriver for both discussions and posts