Enable template preview in post editor for non administrators#60447
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: +61 B (0%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
@getdave I'd love to get your take on this. I feel like there has to be a better way to do this.
essentially what we want here is a preview-only mode of the navigation block that readers a full rich preview of the navigation menu in question for any users that are able to view the item in the rest API but cannot edit it.
We recently added this same thing to the template part block in #60326
| supportsTemplateMode && | ||
| isViewable && | ||
| canEditTemplate && | ||
| canViewTemplate && |
There was a problem hiding this comment.
This is potentially the most impactful change because it's not clear exactly what the availability of the template changes in the editor.
7e095bd to
bd076c1
Compare
bd076c1 to
0eb074a
Compare
|
@youknowriad I cut this down to only include the most fundamental changes. The additional updates to the template part block were moved here: #60787 And a new issue for the Navigation block was created #60809 Let me know if you want me to change anything else here or whether you agree this is ready to get merged :) |
youknowriad
left a comment
There was a problem hiding this comment.
Thanks for your work here. This looks good.
| const _canEditTemplate = | ||
| select( coreStore ).canUser( 'create', 'templates' ) ?? false; | ||
|
|
There was a problem hiding this comment.
Is this check correct? Should it check if a user can edit templates or template parts?
There was a problem hiding this comment.
@Mamaduka As far as I know they use one singular REST Controler for both. And that lives under templates 🤔
I may of course have missed something
There was a problem hiding this comment.
They have different rest bases - templates and template-parts.
I'm asking because I'm working to bulk update canUser selectors, and I would instead use the correct post type for new checks. See #63415.
What?
Closing #60316. Supersedes #58301 and follows #60317 & #60326
Why?
To allow non administrators to preview templates whilst editing content in the regular post editor
How?
Adjusting the conditions when to display templates to allow users that can only view templates to still preview them.
Testing Instructions