-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fetch classic Menus and Pages using view (readonly) context #37884
Conversation
Size Change: +7 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
packages/core-data/src/entities.js
Outdated
@@ -205,7 +205,7 @@ export const prePersistPostType = ( persistedRecord, edits ) => { | |||
* @return {Promise} Entities promise | |||
*/ | |||
async function loadPostTypeEntities() { |
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.
FYI these are the changes from #37685
That's expected. It's easy to miss. Here's what I wrote in the PR description:
|
Okay, if that is the case, then the dropdown should be hidden or something. A empty dropdown looks weird / broken. |
Oh I see. Looking again this morning with a less tired brain I see that's a bug. The
|
The perfect solution here, would be, if you are a contributor, show a list of classic menus and allow you to create a navigation block, but save the data to the post content. What is the point of making the api request and to be able to see a list of classic menus and not be able to do anything about it... |
I agree that we may need to introduce a mechanic that allows us to save Nav blocks to the post content rather than the CPT. This will be required for example, when we start building more complex "mega menus" that may not be suitable to be saved without presentational attributes and thus won't be designed to be transferable across Themes.
Well indeed. Ideally we want to avoid unnecessary API requests and it should be possible to do so. |
I've addressed the UI issue of showing/hiding the |
I have approved #37980. Once this is merge and this PR is rebased, I will re-review this. |
Bear in mind we cannot merge this until @youknowriad merges #37685 |
08e31b7
to
db43ac7
Compare
@spacedmonkey This PR has now been rebased. |
db43ac7
to
0313d8f
Compare
Yeh fair enough. It's not conditionally shown because - I guess - we never intended such a state to exist. Indeed I wonder whether we ought to have some inline message here? Seems like a confusing state. If not then I'd suggest we raise a follow up PR to only show his |
I have created a follow up ticket, for allow contributor's to create navigation blocks. See #38030 |
@spacedmonkey did you want this backported for the RC? |
@getdave i do think it should be yes |
This PR builds on #37685 and acts as a test case for that PR.#37685 is now merged so we can proceed here if ✅Description
On
trunk
we are currently attempting to "read" data about Menus and Pages but we are using theedit
context to do so. Therefore when you are a lower permission user (e.g.Contributor
role) this results in a 403 error because the user doesn't haveedit
permissions.This PR follows what @youknowriad suggests which is to adjust the
context
parameter on the call togetEntityRecords
to beview
. This means the request will succeed and the data can be read.Note this test case is rather limited.
How has this been tested?
Compare this to
trunk
where you will see 403 errors.Note that the UI won't change because only
Admin
role users are allowed to create Menus and thus access to creating Navigation Menus from either Classic Menus or Pages is not exposed in the UI.Screenshots
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).