Skip to content

Commit

Permalink
Merge pull request #2762 from wordpress-mobile/try/jetpack-stories-bl…
Browse files Browse the repository at this point in the history
…ock-hide

Mobile stories block: hide behind feature flag
  • Loading branch information
mzorz authored Oct 30, 2020
2 parents 4259361 + a361b1d commit f6b14e4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/jetpack-editor-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
* Internal dependencies
*/
import { JETPACK_DATA_PATH } from '../jetpack/extensions/shared/get-jetpack-data';
/**
* WordPress dependencies
*/
import { useDispatch, useSelect } from '@wordpress/data';

// When adding new blocks to this list please also consider updating ./block-support/supported-blocks.json
const supportedJetpackBlocks = {
Expand Down Expand Up @@ -40,6 +44,17 @@ export default ( jetpackState ) => {

const jetpackData = setJetpackData( jetpackState );

const mediaFilesCollectionBlock = useSelect( ( select ) => {
return select( 'core/block-editor' ).getSettings( 'capabilities' ).mediaFilesCollectionBlock;
}, [] );


if ( mediaFilesCollectionBlock !== true ) {
useDispatch( 'core/edit-post' ).hideBlockTypes( [ 'jetpack/story' ] );
} else {
useDispatch( 'core/edit-post' ).showBlockTypes( [ 'jetpack/story' ] );
}

if ( __DEV__ ) {
require( '../jetpack/extensions/editor' );
}
Expand Down

0 comments on commit f6b14e4

Please sign in to comment.