Skip to content

Instantly share code, notes, and snippets.

@p-jackson
Created August 9, 2019 04:52
Show Gist options
  • Save p-jackson/fd0a1b14bf1791ca2e973ad9c9c75042 to your computer and use it in GitHub Desktop.
Save p-jackson/fd0a1b14bf1791ca2e973ad9c9c75042 to your computer and use it in GitHub Desktop.
diff --git a/client/my-sites/checkout/checkout/secure-payment-form.jsx b/client/my-sites/checkout/checkout/secure-payment-form.jsx
index f30dafbf33..ff83ebadd1 100644
--- a/client/my-sites/checkout/checkout/secure-payment-form.jsx
+++ b/client/my-sites/checkout/checkout/secure-payment-form.jsx
@@ -193,7 +193,7 @@ export class SecurePaymentForm extends Component {
} );
};
- submitTransaction( event ) {
+ async submitTransaction( event ) {
event && event.preventDefault();
const params = pick( this.props, [ 'cart', 'transaction' ] );
@@ -213,12 +213,12 @@ export class SecurePaymentForm extends Component {
params.transaction.payment.paymentMethod = 'WPCOM_Billing_MoneyPress_Paygate';
}
- this.maybeSetSiteToPublic( { cart: params.cart } );
+ await this.maybeSetSiteToPublic( { cart: params.cart } );
submitTransaction( params );
}
- maybeSetSiteToPublic( { cart } ) {
+ async maybeSetSiteToPublic( { cart } ) {
const { isJetpack, selectedSiteId, siteIsPrivate } = this.props;
if ( isJetpack || ! siteIsPrivate ) {
@@ -233,10 +233,13 @@ export class SecurePaymentForm extends Component {
} );
if ( forcedAtomicProducts.length ) {
- defer( () => {
- // Until Atomic sites support being private / unlaunched, set them to public on upgrade
- this.props.saveSiteSettings( selectedSiteId, { blog_public: 1 } );
- debug( 'Setting site to public because it is an Atomic plan' );
+ await new Promise( resolve => {
+ defer( async () => {
+ // Until Atomic sites support being private / unlaunched, set them to public on upgrade
+ await this.props.saveSiteSettings( selectedSiteId, { blog_public: 1 } );
+ debug( 'Setting site to public because it is an Atomic plan' );
+ resolve();
+ } );
} );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment