File tree Expand file tree Collapse file tree 4 files changed +10
-40
lines changed Expand file tree Collapse file tree 4 files changed +10
-40
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,6 @@ import {
3232import { store as editorStore } from '../../store' ;
3333import { unlock } from '../../lock-unlock' ;
3434import isTemplateRevertable from '../../store/utils/is-template-revertable' ;
35- import isTemplatePartRevertable from '../../store/utils/is-template-part-revertable' ;
3635import { exportPatternAsJSONAction } from './export-pattern-action' ;
3736import { CreateTemplatePartModalContents } from '../create-template-part-modal' ;
3837
@@ -792,9 +791,7 @@ const resetTemplateAction = {
792791 id : 'reset-template' ,
793792 label : __ ( 'Reset' ) ,
794793 isEligible : ( item ) => {
795- return item . type === TEMPLATE_PART_POST_TYPE
796- ? isTemplatePartRevertable ( item )
797- : isTemplateRevertable ( item ) ;
794+ return isTemplateRevertable ( item ) ;
798795 } ,
799796 icon : backup ,
800797 supportsBulk : true ,
Original file line number Diff line number Diff line change @@ -15,8 +15,6 @@ import { decodeEntities } from '@wordpress/html-entities';
1515 * Internal dependencies
1616 */
1717import isTemplateRevertable from './utils/is-template-revertable' ;
18- import isTemplatePartRevertable from './utils/is-template-part-revertable' ;
19- import { TEMPLATE_PART_POST_TYPE } from './constants' ;
2018export * from '../dataviews/store/private-actions' ;
2119
2220/**
@@ -244,11 +242,7 @@ export const revertTemplate =
244242 const noticeId = 'edit-site-template-reverted' ;
245243 registry . dispatch ( noticesStore ) . removeNotice ( noticeId ) ;
246244
247- const isRevertable =
248- template . type === TEMPLATE_PART_POST_TYPE
249- ? isTemplatePartRevertable
250- : isTemplateRevertable ;
251- if ( ! isRevertable ( template ) ) {
245+ if ( ! isTemplateRevertable ( template ) ) {
252246 registry
253247 . dispatch ( noticesStore )
254248 . createErrorNotice ( __ ( 'This template is not revertable.' ) , {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -6,18 +6,18 @@ import { TEMPLATE_ORIGINS } from '../constants';
66// Copy of the function from packages/edit-site/src/utils/is-template-revertable.js
77
88/**
9- * Check if a template is revertable to its original theme-provided template file.
9+ * Check if a template or template part is revertable to its original theme-provided file.
1010 *
11- * @param {Object } template The template entity to check.
12- * @return {boolean } Whether the template is revertable.
11+ * @param {Object } templateOrTemplatePart The entity to check.
12+ * @return {boolean } Whether the entity is revertable.
1313 */
14- export default function isTemplateRevertable ( template ) {
15- if ( ! template ) {
14+ export default function isTemplateRevertable ( templateOrTemplatePart ) {
15+ if ( ! templateOrTemplatePart ) {
1616 return false ;
1717 }
18- /* eslint-disable camelcase */
18+
1919 return (
20- template ?. source === TEMPLATE_ORIGINS . custom && template ?. has_theme_file
20+ templateOrTemplatePart . source === TEMPLATE_ORIGINS . custom &&
21+ templateOrTemplatePart . has_theme_file
2122 ) ;
22- /* eslint-enable camelcase */
2323}
You can’t perform that action at this time.
0 commit comments