Skip to content

Commit

Permalink
Blocks: do not Jetpack collection on WordPress.com. (#15310)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeherve authored Apr 6, 2020
1 parent fe54fe4 commit 226e888
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions extensions/shared/block-category.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,29 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import JetpackLogo from '../shared/jetpack-logo';
import { isAtomicSite, isSimpleSite } from '../shared/site-type-utils';

/**
* Return bool depending on registerBlockCollection compatibility.
*
* @todo When Jetpack's minimum is WP 5.4. Remove this function and update all block categories.
*
* @return {boolean} Value to indicate function support.
* @returns {boolean} Value to indicate function support.
*/
export const supportsCollections = () => {
return typeof registerBlockCollection === 'function';
};

const isWpcom = isSimpleSite() || isAtomicSite();

if ( supportsCollections() ) {
registerBlockCollection( 'jetpack', {
title: 'Jetpack',
icon: <JetpackLogo />,
} );
// We do not want the Jetpack collection on WordPress.com (Simple or Atomic).
if ( ! isWpcom ) {
registerBlockCollection( 'jetpack', {
title: 'Jetpack',
icon: <JetpackLogo />,
} );
}
} else {
// This can be removed once Jetpack's minimum is Core 5.4.
setCategories( [
Expand Down

0 comments on commit 226e888

Please sign in to comment.