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

Reusable blocks: Don't show trashed blocks in the editor or frontend #12345

Merged
merged 1 commit into from
Nov 28, 2018

Conversation

noisysocks
Copy link
Member

Fixes #12339.

Changes the logic surrounding reusable blocks so that we:

  • Do not render a reusable block in the editor if it is trashed.
  • Do not render a reusable block on the frontend if it is non-published or password protected.

This matches one's intuition about what Trashing something does.

Testing

  1. Create a new post
  2. Insert a block
  3. Convert the block to a reusable block
  4. Go to Manage All Reusable Blocks
  5. Trash the reusable block you created
  6. Go back to the post you created. The reusable block should appear as Deleted or unavailable
  7. Preview the post. The reusable block should not appear

@noisysocks noisysocks added [Type] Bug An existing feature does not function as intended [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) labels Nov 27, 2018
@noisysocks noisysocks added this to the 4.6 milestone Nov 27, 2018
}

const results = compact( map( posts, ( post ) => {
if ( post.status === 'trash' ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we match the check in the backend (status publish and no password)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thought was that having it this way would allow for some advanced functionality, e.g. marking a reusable block as private means that it becomes an editor only block.

After considering it some more, I think you're right. Let's keep it simple for now and we can enable more advanced functionality in future releases if needed.

I've updated the check.

Don't render a reusable block in the editor or frontend if it is
non-published or password protected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants