-
-
Notifications
You must be signed in to change notification settings - Fork 612
[6.x] Add support for filtering conditions in Assets Tag#13936
[6.x] Add support for filtering conditions in Assets Tag #13936jackmcdade wants to merge 1 commit into6.x from
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double filterByType applied on collection path
Low Severity
When the index() method takes the collection path, filterByType is applied twice. assetsFromCollection already calls filterByType on each field's value internally. Then outputCollection calls applyPostCollectionFilters, which calls filterByType again on the entire resulting collection. While functionally idempotent for now, this is redundant and risks inconsistency if filterByType behavior ever changes.
Uh oh!
There was an error while loading. Please reload this page.
References statamic/ideas#1003
Note
Medium Risk
Changes the assets tag’s core retrieval path from in-memory collection filtering to database/query-builder constraints, which may affect result ordering/edge cases and pagination behavior; covered by new tests but touches widely used template tag behavior.
Overview
The
assetstag now queries containers via an asset query builder (instead of fetching then filtering), enablingfield:conditionfiltering,query_scope, and query-level sorting/pagination/chunking via the shared tag concerns.Legacy params (
folder/recursive,type,not_in,sort,limit/offset) are preserved by applying them as query constraints where possible and as post-processing filters for collections/paginators/chunks. Adds a focusedAssetsTestsuite covering condition filtering (including localized fields), scopes, pagination output shape, and legacy behavior.Written by Cursor Bugbot for commit 6d4a4fb. This will update automatically on new commits. Configure here.