Skip to content

Commit

Permalink
[not verified] Blocks: do not Jetpack collection on WordPress.com. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jeherve committed Apr 6, 2020
1 parent 9664982 commit a11aa9d
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 a11aa9d

Please sign in to comment.