-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Navigation: fix invalid permissions warning by avoiding using trashed wp_navigation posts (JS implementation) #42982
Navigation: fix invalid permissions warning by avoiding using trashed wp_navigation posts (JS implementation) #42982
Conversation
Size Change: +1.54 kB (0%) Total Size: 1.27 MB
ℹ️ View Unchanged
|
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.
I think this is the correct approach, since the API serves all the items if we don't exclude a status. My question is why use the notion of missing navMenuResolvedButMissing
and not just say trashed or not published?
Because the hook exports consistent data about the resolution status of a menu. I don't want to pollute that with information status about the navigation menu's publish status. As far as we the consumer of the hook are concerned the Navigation menu is "missing". Internally the hook knows that that's because the post is trashed but we don't need to know. I'm trying to encapsulate that info. The only thing to consider is if someone did a |
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.
I think the reasoning @getdave had for "missing" as a hook function is good and the code otherwise does what it says on the tin.
This works as described in #42940, but the deleted nav still shows on the front end. Is that expected? |
Great catch. I pushed a change but didn't get a chance to fully test it. Please could you run through it? Feel free to merge when you're happy. |
What?
This PR fixes the Nav block to avoid it showing a permissions warning for posts which don't exist.
First reported in #42735 (review).
Alternative to #42940. See that PR for more details.
Why?
See #42940.
How?
Instead of ignoring the posts on the REST API end, this PR treats non-published posts as "missing" on the JavaScript side.
This avoids some of the misdirection and complexity of introducing changes to the REST API.
Testing Instructions
See #42940.
Screenshots or screencast
See #42940.