Custom Posts: Add Set as Homepage / Posts Page actions#25575
Open
crazytonyli wants to merge 7 commits into
Open
Custom Posts: Add Set as Homepage / Posts Page actions#25575crazytonyli wants to merge 7 commits into
crazytonyli wants to merge 7 commits into
Conversation
Consolidate homepage and posts page tracking into a single PageRole enum. Update HomepageSetting to track both homepage and posts page IDs from site settings.
Add view model methods that update site settings via the WordPress core REST API with optimistic local state updates and rollback on failure.
Show Set as Homepage, Set as Posts Page, and Set as Regular Page actions in a Page Attributes submenu for published pages. Add a "Posts page" badge alongside the existing "Homepage" badge using the consolidated pageRole property.
Add currentUserCan(_:) to WordPressClient for checking user capabilities via the cached current user data. Only show the Page Attributes submenu when the user has the manage_options capability.
WordPressClient.fetchSiteSettings now takes a forceRefresh flag that bypasses the loadSiteSettingsTask cache and re-runs the network fetch. CustomPostListViewModel passes forceRefresh through from pullToRefresh, so the Pages list picks up homepage and posts-page assignments changed outside the app without requiring an app relaunch.
The mark-page-roles guard checked for .custom("any"), a legacy form
that predates the .any case wordpress-rs now exposes. The All tab
uses .any, so the predicate never matched and the Homepage / Posts
page badges never rendered there.
Contributor
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 32281 | |
| Version | PR #25575 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | f12059d | |
| Installation URL | 51en7rdjfd0b8 |
Contributor
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 32281 | |
| Version | PR #25575 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | f12059d | |
| Installation URL | 1598rfc7kcu18 |
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.


Note
I recommend reviewing by commits. The first commit is code-format changes and can be ignored.
Description
Fix https://linear.app/a8c/issue/CMM-1981
Mirror the existing Pages: showing "Page Attributes" menus on published Pages.