-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Navigation: Always create a fallback menu #47684
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
Conversation
|
Flaky tests detected in 3a5252b. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4192731842
|
|
Size Change: +30 B (0%) Total Size: 1.33 MB
ℹ️ View Unchanged
|
|
A problem with this is that I cannot ever be in a state where I have no block menus. In the editor if I delete the last block navigation it will just create a new one with a page list in it. |
Yes, when you try to use it. Is that a problem? |
c536475 to
3b5a0a9
Compare
|
Actually I am wrong @scruffian because if I have block navigation then the block has a ref and when I delete the menu that the ref points to I get the warning. If there are no menus that I can switch to, I see the warning and I can:
Cool! 👍🏻 |
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.
If I have a menu with a ref and the ref'd menu is deleted, when I open the template part I see the warning briefly and then the new menu gets created.
- We should only autocreate if there is no ref.
Good catch. Fixed in 4fd95cb |
|
@scruffian this PR should also remove the current page list fallback behavior . 🙏🏻 |
|
I think this is ready for another review. |
3a15b83 to
3d041f2
Compare
|
|
I added a commit to fix the tests. |
716f4ec to
e072b47
Compare
This is not what happens in my testing. |
01988b7 to
083adec
Compare
1d59818 to
3a5252b
Compare
|
@draganescu It's not very RESTful, I'd probably just make a one-off endpoint in |
3a5252b to
f5fe083
Compare
|
@TimothyBJacobs a one off endpoint in |
|
@draganescu Right so a REST endpoint that you can query and say get me a fallback menu and it will return one. Can be used in editor and front of site. This would
|
|
This PR creates multiple wp_navigation CPTs when there are multiple blocks in the same post. Reverting in #48602 until we have a way to deal with that problem. |
This code doesn't work, and even if it did it's a hack that is probably overly broad. In the past a fallback navigation was created when one didn't exist. This used to be created in `render_block_core_navigation` (see WordPress/gutenberg#47684) but no longer happens. This has lead to a number of blogs having this fallback navigation created when an a12 visited their site. This means that the a12s details - wpcom username, email address etc are in the generated export file. It feels unhelpful to have this in the export file, partly because it might need explaining if the legal time share an export as part of a legal request, and partly because a12s data is shared to anyone exporting an affected blog. This change tries to remove the information when generating the export file, but is somewhat hampered by a lack of relevent hooks and also by a way of identifying current and former a12s. Instead it chooses a relevant SQL generation, hackily identifies whether the query is the relevant part of the export, and then modifies it to add some SQL excluding wp_navigation post types that were created by users that are not currently part of the blog. See also https://linear.app/a8c/issue/DOTCOM-13020
This code doesn't work, and even if it did it's a hack that is probably overly broad. In the past a fallback navigation was created when one didn't exist. This used to be created in `render_block_core_navigation` (see WordPress/gutenberg#47684) but no longer happens. This has lead to a number of blogs having this fallback navigation created when an a12 visited their site. This means that the a12s details - wpcom username, email address etc are in the generated export file. It feels unhelpful to have this in the export file, partly because it might need explaining if the legal time share an export as part of a legal request, and partly because a12s data is shared to anyone exporting an affected blog. This change tries to remove the information when generating the export file, but is somewhat hampered by a lack of relevent hooks and also by a way of identifying current and former a12s. Instead it chooses a relevant SQL generation, hackily identifies whether the query is the relevant part of the export, and then modifies it to add some SQL excluding wp_navigation post types that were created by users that are not currently part of the blog. See also https://linear.app/a8c/issue/DOTCOM-13020
What?
This creates a fallback navigation CPT when there isn't one. Fixes #47058
Why?
This should simplify several things
How?
We automatically create a wp_navigation CPT in both the editor and the frontend, if a user doesn't have one.
Testing Instructions
Testing Instructions for Keyboard
As above.