Skip to content
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

Fix: Notice blocks don't match template doesn't appear; Add test case; #15418

Merged

Conversation

jorgefilipecosta
Copy link
Member

@jorgefilipecosta jorgefilipecosta commented May 3, 2019

Description

Fix: #15743

During the refactor to use block-editor package we missed to pass the template setting. This caused a regression where the notice that should appear when the blocks don't match the template stopped appearing.

This PR's simply passes the missing setting and adds a test case to avoid this bug in the future.

How has this been tested?

I added the following CPT:

function gutenberg_test_cpt_locking() {
	$template = array(
		array( 'core/image' ),
		array(
			'core/paragraph',
			array(
				'placeholder' => 'Add a description',
			),
		),
		array( 'core/quote' ),
	);
	register_post_type(
		'locked-all-post',
		array(
			'public'        => true,
			'label'         => 'Locked All Post',
			'show_in_rest'  => true,
			'template'      => $template,
			'template_lock' => 'all',
		)
	);
}
add_action( 'init', 'gutenberg_test_cpt_locking' );

I created a new 'Locked All Post' I went to the code editor.
I removed the first image block.
I verified a notice saying the blocks don't match the template appeared.

@jorgefilipecosta jorgefilipecosta added [Type] Bug An existing feature does not function as intended [Feature] Templates API Related to API powering block template functionality in the Site Editor [Type] Regression Related to a regression in the latest release labels May 3, 2019
@jorgefilipecosta jorgefilipecosta force-pushed the fix/notice-blocks-dont-match-template-does-not-appear branch 2 times, most recently from 39591b2 to 88085a3 Compare May 6, 2019 13:35
@jorgefilipecosta jorgefilipecosta force-pushed the fix/notice-blocks-dont-match-template-does-not-appear branch from 88085a3 to 31c6db6 Compare May 6, 2019 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Templates API Related to API powering block template functionality in the Site Editor [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Block Template Warning Missing in 5.2
2 participants