Conversation
Contributor
Test this PR in WordPress PlaygroundYou can test this pull request directly in WordPress Playground: This will install and activate the plugin with the changes from this PR. |
Subscriptions can now be organized into folders using the existing friends-virtual-user taxonomy hierarchy. Folders are parent terms with an is_folder meta flag, and subscriptions are moved by setting their parent term ID. Changes: - Make friends-virtual-user taxonomy hierarchical - Add Subscription methods: get_folder(), move_to_folder(), create_folder(), get_folders(), is_folder() - Add User_Query methods: subscriptions_in_folder(), unfoldered_subscriptions() — both filter the cached all_subscriptions() result in PHP, no extra DB queries - Add folder attribute to friends-list block with editor dropdown - Add AJAX handlers for move-to-folder and create-folder - Show folder chip in author-header chips - Localize folder data for the block editor
- Folder selector dropdown on author header to move subscriptions into folders or create new ones via JS prompt - "Grouped by Folder" mode for friends-list block renders folders as collapsible <details> sections with subscription counts - Unfoldered subscriptions shown under "Uncategorized" section - Starred subscriptions kept as separate quick-access list - Exclude folder terms from subscription queries - Fix nonce mismatch for create-folder AJAX
Tests cover: - Creating folders and subfolders - Moving subscriptions to folders and back to root - Querying subscriptions by folder - Querying unfoldered subscriptions - Folders excluded from subscription lists - get_folders returns only folder terms - Subscription terms are not folders - Taxonomy is hierarchical - Friends-list block renders folder view - Friends-list block filters by specific folder
User_Query extends WP_User_Query, so creating a new instance always loads all WordPress users. The folder filter methods were adding filtered subscriptions on top of that. Fix by using a lightweight User_Query_Result container for subscriptions_in_folder() and unfoldered_subscriptions() that only holds the filtered results without triggering WP_User_Query.
- Widget_Friends_List shows folders as collapsible accordion sections with unfoldered subscriptions in a separate section below - Author header template shows folder selector dropdown for subscriptions (same UI as block theme) - Remove WP_User_Query type hint from list_friends() to accept User_Query_Result from folder queries
7e5b127 to
a96f477
Compare
ActivityPub 7.6.0 deprecated Followers::count_followers() in favour of Followers::count(). Add a single compatibility shim in the ActivityPub feed parser and route both call sites through it.
- Add form(), update(), defaults() to Widget_Friends_List with the same Display (subscriptions/starred/folders) and Folder filter options the block has; also saves/restores the widget title - Skip folder terms in get_list_items() so they never render as list items - Fall back to user_login when display_name is empty (block and widget)
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.
This uses the existing
friends-virtual-usertaxonomy hierarchy to let you organize subscriptions into folders. Folders are parent terms, subscriptions are moved by changing their parent — no new tables, no slow meta queries.On the author page there's now a dropdown to move a subscription into a folder or create a new one. The friends-list block has a new "Grouped by Folder" mode that renders folders as collapsible sections. Starred subscriptions are still shown separately as a quick-access list.
The folder queries filter the already-cached
all_subscriptions()result in PHP, so there's no extra database hit. A lightweightUser_Query_Resultcontainer avoids theWP_User_Querypitfall where creating a new instance loads all WordPress users.Changes:
friends-virtual-usertaxonomy hierarchicalSubscription:get_folder(),move_to_folder(),create_folder(),get_folders(),is_folder()User_Query:subscriptions_in_folder(),unfoldered_subscriptions()using in-memory filteringUser_Query_Resultcontainer class for filtered results<details>sections