Add linkable items dropdown data for navigation menus#22558
Merged
Add linkable items dropdown data for navigation menus#22558
Conversation
Implements linkable items fetching for the navigation menus feature: - Add fetchCategories() and fetchTags() methods to NavMenuRestClient - Categories and tags are sorted alphabetically (A-Z) and limited to 20 items - Update NavMenusViewModel to load items when menu item type changes - Posts and pages support pending wordpress-rs API availability Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements fetching posts and pages for menu item linking: - Add fetchPosts() using posts().listWithEditContext() with PostEndpointType.Posts - Add fetchPages() using posts().listWithEditContext() with PostEndpointType.Pages - Posts and pages are sorted by date (newest first) and limited to 20 items - Update ViewModel to call the new methods when POST or PAGE type is selected Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changes the "Select an item" placeholder to be type-specific: - "Select a post" for posts - "Select a page" for pages - "Select a category" for categories - "Select a tag" for tags Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Renames result types for better naming consistency: - NavMenusResult → NavMenuListResult - NavMenuItemsResult → NavMenuItemListResult Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Collaborator
Generated by 🚫 Danger |
When a post, page, category, or tag is selected from the dropdown, always update the title field with the item's title instead of only setting it when the title is blank. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename test to reflect that title is always set from selected item - Add test verifying title is replaced even when already filled - Add test verifying loading state is set when changing to non-custom type - Add lenient mocks for linkable items fetch methods Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Extract common logic for fetching linkable items into private helper methods: - fetchPostType() for posts and pages (sorted by date descending) - fetchTermType() for categories and tags (sorted alphabetically) This addresses the SonarCloud code duplication warning. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
Extract specific error messages from WpRequestResult variants instead of returning generic messages. The WpError variant now passes through the actual API error message when available, improving debugging for users and developers. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Linkable items (posts, pages, categories, tags) are flat lists without hierarchy, so indentLevel and related accessibility descriptions were incorrectly applied. This removes: - indentLevel property from LinkableItemOption data class - Unnecessary accessibility description in LinkableItemDropdown - Unnecessary indent-based padding in LinkableItemDropdown Parent items correctly retain indentLevel as they have hierarchy. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Some posts/pages may have an empty raw title but a valid rendered title. This ensures dropdown items always show a title when available. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Contributor
|
|
Contributor
|
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #22558 +/- ##
==========================================
- Coverage 38.25% 38.24% -0.02%
==========================================
Files 2237 2237
Lines 111007 111084 +77
Branches 15519 15537 +18
==========================================
+ Hits 42467 42479 +12
- Misses 65007 65067 +60
- Partials 3533 3538 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.





Description
Partially addresses CMM-1166 by implementing the dropdown data loading for the menu item type selection in the navigation menus feature:
Uses wordpress-rs networking library (not FluxC) with the following endpoints:
posts().listWithEditContext()withPostEndpointType.Posts/PostEndpointType.Pagesterms().listWithEditContext()withTermEndpointType.Categories/TermEndpointType.TagsAlso updates the dropdown placeholder text to be type-specific (e.g., "Select a post" instead of generic "Select an item").
Limitations
Test plan
Menu item type dropdown:
linked-items.mp4