Template activation: duplicate action should be available outside GB#72513
Template activation: duplicate action should be available outside GB#72513
Conversation
| duplicatePost; | ||
|
|
||
| // @ts-ignore | ||
| if ( ! globalThis.IS_GUTENBERG_PLUGIN ) { |
There was a problem hiding this comment.
Nitpick: we could have a single if ( ! globalThis.IS_GUTENBERG_PLUGIN && postType === 'page')
There was a problem hiding this comment.
We can't, I get an error then
jorgefilipecosta
left a comment
There was a problem hiding this comment.
Worked well in my tests forcing IS_GUTENBERG_PLUGIN to false duplicate was still avaliable in templates, template parts and patterns, but not on pages. with IS_GUTENBERG_PLUGIN unchanged it is also available on pages.
| canCreate && | ||
| duplicatePost | ||
| : undefined, | ||
| canDuplicate, |
There was a problem hiding this comment.
There was a problem hiding this comment.
Good catch @oandregal, it is making it available for posts too on the inspector. cc: @ellatrix
There was a problem hiding this comment.
Oh, I didn't know this affects the post editor
| duplicatePost; | ||
|
|
||
| // @ts-ignore | ||
| if ( globalThis.IS_GUTENBERG_PLUGIN ) { |
There was a problem hiding this comment.
| if ( globalThis.IS_GUTENBERG_PLUGIN ) { | |
| if ( ! globalThis.IS_GUTENBERG_PLUGIN ) { |
|
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. |
36a0990 to
2e2b758
Compare
There was a problem hiding this comment.
The failing tests are unrelated to this PR and started failing in trunk earlier today, seemingly after #72487. Let's merge this without those tests passing to get ready for Beta1.
|
Yes These are failing on trunk too and we need this PR to get merged and included in a package asap. Let's merge. I will skip the performance test too. |
…72513) Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org> Co-authored-by: oandregal <oandregal@git.wordpress.org> Co-authored-by: priethor < priethor@git.wordpress.org>
|
I just cherry-picked this PR to the wp/latest branch to get it included in the next release: a735e7b |
…72513) Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org> Co-authored-by: oandregal <oandregal@git.wordpress.org> Co-authored-by: priethor < priethor@git.wordpress.org>
|
I just cherry-picked this PR to the release/21.9 branch to get it included in the next release: 2d4bf41 |

What?
The duplicate activation is not available outside of GB. Apparently it should be removed for pages, so I'm explicitly removing it for that post type and leaving things otherwise the same.
Why?
It's an essential part of the template activation feature.
How?
Testing Instructions
Edit the code and remove the
globalThis.IS_GUTENBERG_PLUGINnegation. Verify that you can't duplicate pages. Verify that you can duplicate templates.Testing Instructions for Keyboard
Screenshots or screencast