Skip to content

Commit dbfe960

Browse files
committed
Revert "Fix e2e test"
This reverts commit 153a4d8.
1 parent 09be74c commit dbfe960

File tree

1 file changed

+3
-45
lines changed

1 file changed

+3
-45
lines changed

packages/editor/src/components/post-template/block-theme.js

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,17 @@ export default function BlockThemeControl( { id } ) {
3131
onNavigateToEntityRecord,
3232
getEditorSettings,
3333
hasGoBack,
34-
hasSpecificTemplate,
3534
} = useSelect( ( select ) => {
36-
const {
37-
getRenderingMode,
38-
getEditorSettings: _getEditorSettings,
39-
getCurrentPost,
40-
} = unlock( select( editorStore ) );
35+
const { getRenderingMode, getEditorSettings: _getEditorSettings } =
36+
unlock( select( editorStore ) );
4137
const editorSettings = _getEditorSettings();
42-
const currentPost = getCurrentPost();
4338
return {
4439
isTemplateHidden: getRenderingMode() === 'post-only',
4540
onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,
4641
getEditorSettings: _getEditorSettings,
4742
hasGoBack: editorSettings.hasOwnProperty(
4843
'onNavigateToPreviousEntityRecord'
4944
),
50-
hasSpecificTemplate: !! currentPost.template,
5145
};
5246
}, [] );
5347

@@ -58,8 +52,6 @@ export default function BlockThemeControl( { id } ) {
5852
'wp_template',
5953
id
6054
);
61-
const { getEntityRecord } = useSelect( coreStore );
62-
const { editEntityRecord } = useDispatch( coreStore );
6355
const { createSuccessNotice } = useDispatch( noticesStore );
6456
const { setRenderingMode, setDefaultRenderingMode } = unlock(
6557
useDispatch( editorStore )
@@ -134,45 +126,11 @@ export default function BlockThemeControl( { id } ) {
134126
<MenuGroup>
135127
{ canCreateTemplate && (
136128
<MenuItem
137-
onClick={ async () => {
129+
onClick={ () => {
138130
onNavigateToEntityRecord( {
139131
postId: template.id,
140132
postType: 'wp_template',
141133
} );
142-
// When editing a global template,
143-
// activate the auto-draft. This is not
144-
// immediately live (we're not saving
145-
// site options), and when nothing is
146-
// saved, the setting will be ignored.
147-
// In the future, we should make the
148-
// duplication explicit, so there
149-
// wouldn't be an "edit" button for
150-
// static theme templates.
151-
if ( ! hasSpecificTemplate ) {
152-
const activeTemplates =
153-
await getEntityRecord(
154-
'root',
155-
'site'
156-
).active_templates;
157-
if (
158-
activeTemplates[
159-
template.slug
160-
] !== template.id
161-
) {
162-
editEntityRecord(
163-
'root',
164-
'site',
165-
undefined,
166-
{
167-
active_templates: {
168-
...activeTemplates,
169-
[ template.slug ]:
170-
template.id,
171-
},
172-
}
173-
);
174-
}
175-
}
176134
onClose();
177135
mayShowTemplateEditNotice();
178136
} }

0 commit comments

Comments
 (0)