Skip to content

Commit

Permalink
Try removing the parameter from the iFrame directly
Browse files Browse the repository at this point in the history
  • Loading branch information
jeherve committed Dec 1, 2020
1 parent a39c6cf commit 4bdd229
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
15 changes: 15 additions & 0 deletions client/gutenberg/editor/calypsoify-iframe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import WebPreview from 'calypso/components/web-preview';
import { editPost, trashPost } from 'calypso/state/posts/actions';
import { getEditorPostId } from 'calypso/state/editor/selectors';
import { protectForm, ProtectedFormProps } from 'calypso/lib/protect-form';
import isAtomicSite from 'calypso/state/selectors/is-site-automated-transfer';
import isSiteWPForTeams from 'calypso/state/selectors/is-site-wpforteams';
import getSiteUrl from 'calypso/state/selectors/get-site-url';
import PageViewTracker from 'calypso/lib/analytics/page-view-tracker';
Expand All @@ -59,6 +60,7 @@ import { setMediaLibrarySelectedItems } from 'calypso/state/media/actions';
import { fetchMediaItem, getMediaItem } from 'calypso/state/media/thunks';
import Iframe from './iframe';
import type { RequestCart } from '@automattic/shopping-cart';
import versionCompare from 'calypso/lib/version-compare';

/**
* Types
Expand Down Expand Up @@ -803,6 +805,19 @@ const mapStateToProps = (
...( !! stripeConnectSuccess && { stripe_connect_success: stripeConnectSuccess } ),
} );

// On some Jetpack sites (9.2+, not Atomic),
// Calypsoify is currently broken.
// Let's not enable it for them.
// Reference: https://github.com/Automattic/jetpack/pull/17939
const jetpackVersion = getSiteOption( state, siteId, 'jetpack_version' );
const isBrokenJetpack =
jetpackVersion &&
versionCompare( jetpackVersion, '9.2-alpha', '>=' ) &&
! isAtomicSite( state, siteId );
if ( isBrokenJetpack ) {
queryArgs[ 'calypsoify' ] = 0;
}

// needed for loading the editor in SU sessions
if ( wpcom.addSupportParams ) {
queryArgs = wpcom.addSupportParams( queryArgs );
Expand Down
15 changes: 1 addition & 14 deletions client/state/selectors/get-gutenberg-editor-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,13 @@
* Internal dependencies
*/
import { isEligibleForGutenframe } from 'calypso/state/gutenberg-iframe-eligible/is-eligible-for-gutenframe';
import isAtomicSite from 'calypso/state/selectors/is-site-automated-transfer';
import { getSelectedEditor } from 'calypso/state/selectors/get-selected-editor';
import { getSiteAdminUrl, getSiteSlug } from 'calypso/state/sites/selectors';
import getSiteOption from 'calypso/state/sites/selectors/get-site-option';
import { getEditorPath } from 'calypso/state/editor/selectors';
import { addQueryArgs } from 'calypso/lib/route';
import versionCompare from 'calypso/lib/version-compare';

export const getGutenbergEditorUrl = ( state, siteId, postId = null, postType = 'post' ) => {
// On some Jetpack sites (9.2+, not Atomic),
// Calypsoify is currently broken.
// Let's not enable it for them.
// Reference: https://github.com/Automattic/jetpack/pull/17939
const jetpackVersion = getSiteOption( state, siteId, 'jetpack_version' );
const isBrokenJetpack =
jetpackVersion &&
versionCompare( jetpackVersion, '9.2-alpha', '>=' ) &&
! isAtomicSite( state, siteId );

if ( ! isEligibleForGutenframe( state, siteId ) && ! isBrokenJetpack ) {
if ( ! isEligibleForGutenframe( state, siteId ) ) {
const siteAdminUrl = getSiteAdminUrl( state, siteId );
let url = `${ siteAdminUrl }post-new.php?post_type=${ postType }`;

Expand Down

0 comments on commit 4bdd229

Please sign in to comment.