From a240ccd0b1d645c9f714bb48e60a778dad59c15a Mon Sep 17 00:00:00 2001 From: Pio Concepcion <49634311+prconcepcion@users.noreply.github.com> Date: Mon, 16 Oct 2023 15:06:15 +0800 Subject: [PATCH] fix (containers): prevent containers from being turned on when updating to the newest version (#2921) * removed container deprecation for the opacity and color update * refactored fix --------- Co-authored-by: prconcepcion --- src/block/blockquote/deprecated.js | 19 ------------------- src/block/call-to-action/deprecated.js | 19 ------------------- src/block/card/deprecated.js | 19 ------------------- src/block/column/deprecated.js | 19 ------------------- src/block/countdown/deprecated.js | 19 ------------------- src/block/feature/deprecated.js | 19 ------------------- src/block/hero/deprecated.js | 20 -------------------- src/block/icon-box/deprecated.js | 19 ------------------- src/block/notification/deprecated.js | 19 ------------------- src/block/posts/deprecated.js | 19 ------------------- src/block/pricing-box/deprecated.js | 19 ------------------- src/block/team-member/deprecated.js | 19 ------------------- src/block/testimonial/deprecated.js | 19 ------------------- 13 files changed, 248 deletions(-) diff --git a/src/block/blockquote/deprecated.js b/src/block/blockquote/deprecated.js index cc7a1ec4e..5f940d480 100644 --- a/src/block/blockquote/deprecated.js +++ b/src/block/blockquote/deprecated.js @@ -22,25 +22,6 @@ const deprecated = [ version: 2, } - // Container borders while the container was turned off was allowed - // before, now it's not allowed. Turn on the container to mimic the - // effect. This goes first before the container paddings check below - // because we need to set the paddings to zero for this to work. - const hasContainerBorders = !! attributes.containerBorderType || - ( typeof attributes.containerBorderRadius !== 'undefined' && attributes.containerBorderRadius !== '' ) || - !! attributes.containerShadow - - if ( ! attributes.hasContainer && hasContainerBorders ) { - newAttributes = { - ...newAttributes, - hasContainer: true, - containerPadding: { - top: 0, right: 0, bottom: 0, left: 0, - }, - containerBackgroundColor: 'transparent', - } - } - newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) diff --git a/src/block/call-to-action/deprecated.js b/src/block/call-to-action/deprecated.js index c4e11b580..c9e9933c5 100644 --- a/src/block/call-to-action/deprecated.js +++ b/src/block/call-to-action/deprecated.js @@ -60,25 +60,6 @@ const deprecated = [ } } - // Container borders while the container was turned off was allowed - // before, now it's not allowed. Turn on the container to mimic the - // effect. This goes first before the container paddings check below - // because we need to set the paddings to zero for this to work. - const hasContainerBorders = !! attributes.containerBorderType || - ( typeof attributes.containerBorderRadius !== 'undefined' && attributes.containerBorderRadius !== '' ) || - !! attributes.containerShadow - - if ( ! attributes.hasContainer && hasContainerBorders ) { - newAttributes = { - ...newAttributes, - hasContainer: true, - containerPadding: { - top: 0, right: 0, bottom: 0, left: 0, - }, - containerBackgroundColor: 'transparent', - } - } - // If the inner blocks are horizontal, adjust to accomodate the new // column gap, it will modify blocks because people used block // margins before instead of a proper column gap. diff --git a/src/block/card/deprecated.js b/src/block/card/deprecated.js index b1fb48a49..85706cb70 100644 --- a/src/block/card/deprecated.js +++ b/src/block/card/deprecated.js @@ -112,25 +112,6 @@ const deprecated = [ } } - // Container borders while the container was turned off was allowed - // before, now it's not allowed. Turn on the container to mimic the - // effect. This goes first before the container paddings check below - // because we need to set the paddings to zero for this to work. - const hasContainerBorders = !! attributes.containerBorderType || - ( typeof attributes.containerBorderRadius !== 'undefined' && attributes.containerBorderRadius !== '' ) || - !! attributes.containerShadow - - if ( ! attributes.hasContainer && hasContainerBorders ) { - newAttributes = { - ...newAttributes, - hasContainer: true, - containerPadding: { - top: 0, right: 0, bottom: 0, left: 0, - }, - containerBackgroundColor: 'transparent', - } - } - // If the inner blocks are horizontal, adjust to accomodate the new // column gap, it will modify blocks because people used block // margins before instead of a proper column gap. diff --git a/src/block/column/deprecated.js b/src/block/column/deprecated.js index 0a63c23e3..5d58d3211 100644 --- a/src/block/column/deprecated.js +++ b/src/block/column/deprecated.js @@ -104,25 +104,6 @@ const deprecated = [ } } - // Container borders while the container was turned off was allowed - // before, now it's not allowed. Turn on the container to mimic the - // effect. This goes first before the container paddings check below - // because we need to set the paddings to zero for this to work. - const hasContainerBorders = !! attributes.containerBorderType || - ( typeof attributes.containerBorderRadius !== 'undefined' && attributes.containerBorderRadius !== '' ) || - !! attributes.containerShadow - - if ( ! attributes.hasContainer && hasContainerBorders ) { - newAttributes = { - ...newAttributes, - hasContainer: true, - containerPadding: { - top: 0, right: 0, bottom: 0, left: 0, - }, - containerBackgroundColor: 'transparent', - } - } - // If the inner blocks are horizontal, adjust to accomodate the new // column gap, it will modify blocks because people used block // margins before instead of a proper column gap. diff --git a/src/block/countdown/deprecated.js b/src/block/countdown/deprecated.js index e2a45a973..79d8d301d 100644 --- a/src/block/countdown/deprecated.js +++ b/src/block/countdown/deprecated.js @@ -24,25 +24,6 @@ const deprecated = [ migrate: attributes => { let newAttributes = { ...attributes } - // Container borders while the container was turned off was allowed - // before, now it's not allowed. Turn on the container to mimic the - // effect. This goes first before the container paddings check below - // because we need to set the paddings to zero for this to work. - const hasContainerBorders = !! attributes.containerBorderType || - ( typeof attributes.containerBorderRadius !== 'undefined' && attributes.containerBorderRadius !== '' ) || - !! attributes.containerShadow - - if ( ! attributes.hasContainer && hasContainerBorders ) { - newAttributes = { - ...newAttributes, - hasContainer: true, - containerPadding: { - top: 0, right: 0, bottom: 0, left: 0, - }, - containerBackgroundColor: 'transparent', - } - } - newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateTypographyGradientColor.migrate( 'digit%s' )( newAttributes ) diff --git a/src/block/feature/deprecated.js b/src/block/feature/deprecated.js index f9b093200..1b7ea594b 100644 --- a/src/block/feature/deprecated.js +++ b/src/block/feature/deprecated.js @@ -89,25 +89,6 @@ const deprecated = [ } } - // Container borders while the container was turned off was allowed - // before, now it's not allowed. Turn on the container to mimic the - // effect. This goes first before the container paddings check below - // because we need to set the paddings to zero for this to work. - const hasContainerBorders = !! attributes.containerBorderType || - ( typeof attributes.containerBorderRadius !== 'undefined' && attributes.containerBorderRadius !== '' ) || - !! attributes.containerShadow - - if ( ! attributes.hasContainer && hasContainerBorders ) { - newAttributes = { - ...newAttributes, - hasContainer: true, - containerPadding: { - top: 0, right: 0, bottom: 0, left: 0, - }, - containerBackgroundColor: 'transparent', - } - } - newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) diff --git a/src/block/hero/deprecated.js b/src/block/hero/deprecated.js index 00134565f..62079da48 100644 --- a/src/block/hero/deprecated.js +++ b/src/block/hero/deprecated.js @@ -60,26 +60,6 @@ const deprecated = [ } } - // Container borders while the container was turned off was allowed - // before, now it's not allowed. Turn on the container to mimic the - // effect. This goes first before the container paddings check below - // because we need to set the paddings to zero for this to work. - const hasContainerBorders = !! attributes.containerBorderType || - ( typeof attributes.containerBorderRadius !== 'undefined' && attributes.containerBorderRadius !== '' ) || - !! attributes.containerShadow - - if ( ! attributes.hasContainer && hasContainerBorders ) { - newAttributes = { - ...newAttributes, - hasContainer: true, - containerPadding: { - top: 0, right: 0, bottom: 0, left: 0, - }, - containerBackgroundColorOpacity: 0, - // containerBackgroundColor: 'transparent', - } - } - // If the inner blocks are horizontal, adjust to accomodate the new // column gap, it will modify blocks because people used block // margins before instead of a proper column gap. diff --git a/src/block/icon-box/deprecated.js b/src/block/icon-box/deprecated.js index bb56f89ed..e58a4e675 100644 --- a/src/block/icon-box/deprecated.js +++ b/src/block/icon-box/deprecated.js @@ -33,25 +33,6 @@ const deprecated = [ } } - // Container borders while the container was turned off was allowed - // before, now it's not allowed. Turn on the container to mimic the - // effect. This goes first before the container paddings check below - // because we need to set the paddings to zero for this to work. - const hasContainerBorders = !! attributes.containerBorderType || - ( typeof attributes.containerBorderRadius !== 'undefined' && attributes.containerBorderRadius !== '' ) || - !! attributes.containerShadow - - if ( ! attributes.hasContainer && hasContainerBorders ) { - newAttributes = { - ...newAttributes, - hasContainer: true, - containerPadding: { - top: 0, right: 0, bottom: 0, left: 0, - }, - containerBackgroundColor: 'transparent', - } - } - newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) diff --git a/src/block/notification/deprecated.js b/src/block/notification/deprecated.js index 270474074..69928f71c 100644 --- a/src/block/notification/deprecated.js +++ b/src/block/notification/deprecated.js @@ -60,25 +60,6 @@ const deprecated = [ } } - // Container borders while the container was turned off was allowed - // before, now it's not allowed. Turn on the container to mimic the - // effect. This goes first before the container paddings check below - // because we need to set the paddings to zero for this to work. - const hasContainerBorders = !! attributes.containerBorderType || - ( typeof attributes.containerBorderRadius !== 'undefined' && attributes.containerBorderRadius !== '' ) || - !! attributes.containerShadow - - if ( ! attributes.hasContainer && hasContainerBorders ) { - newAttributes = { - ...newAttributes, - hasContainer: true, - containerPadding: { - top: 0, right: 0, bottom: 0, left: 0, - }, - containerBackgroundColor: 'transparent', - } - } - // If the inner blocks are horizontal, adjust to accomodate the new // column gap, it will modify blocks because people used block // margins before instead of a proper column gap. diff --git a/src/block/posts/deprecated.js b/src/block/posts/deprecated.js index 57600c758..282d61d17 100644 --- a/src/block/posts/deprecated.js +++ b/src/block/posts/deprecated.js @@ -100,25 +100,6 @@ const deprecated = [ } } - // Container borders while the container was turned off was allowed - // before, now it's not allowed. Turn on the container to mimic the - // effect. This goes first before the container paddings check below - // because we need to set the paddings to zero for this to work. - const hasContainerBorders = !! attributes.containerBorderType || - ( typeof attributes.containerBorderRadius !== 'undefined' && attributes.containerBorderRadius !== '' ) || - !! attributes.containerShadow - - if ( ! attributes.hasContainer && hasContainerBorders ) { - newAttributes = { - ...newAttributes, - hasContainer: true, - containerPadding: { - top: 0, right: 0, bottom: 0, left: 0, - }, - containerBackgroundColor: 'transparent', - } - } - newAttributes = deprecationImageOverlayOpacity.migrate( newAttributes ) newAttributes = deprecateContainerBackgroundColorOpacity.migrate( newAttributes ) newAttributes = deprecateBlockBackgroundColorOpacity.migrate( newAttributes ) diff --git a/src/block/pricing-box/deprecated.js b/src/block/pricing-box/deprecated.js index 6d2bdab26..1700f8da2 100644 --- a/src/block/pricing-box/deprecated.js +++ b/src/block/pricing-box/deprecated.js @@ -60,25 +60,6 @@ const deprecated = [ } } - // Container borders while the container was turned off was allowed - // before, now it's not allowed. Turn on the container to mimic the - // effect. This goes first before the container paddings check below - // because we need to set the paddings to zero for this to work. - const hasContainerBorders = !! attributes.containerBorderType || - ( typeof attributes.containerBorderRadius !== 'undefined' && attributes.containerBorderRadius !== '' ) || - !! attributes.containerShadow - - if ( ! attributes.hasContainer && hasContainerBorders ) { - newAttributes = { - ...newAttributes, - hasContainer: true, - containerPadding: { - top: 0, right: 0, bottom: 0, left: 0, - }, - containerBackgroundColor: 'transparent', - } - } - // If the inner blocks are horizontal, adjust to accomodate the new // column gap, it will modify blocks because people used block // margins before instead of a proper column gap. diff --git a/src/block/team-member/deprecated.js b/src/block/team-member/deprecated.js index 4b1d12903..87b4afc7b 100644 --- a/src/block/team-member/deprecated.js +++ b/src/block/team-member/deprecated.js @@ -60,25 +60,6 @@ const deprecated = [ } } - // Container borders while the container was turned off was allowed - // before, now it's not allowed. Turn on the container to mimic the - // effect. This goes first before the container paddings check below - // because we need to set the paddings to zero for this to work. - const hasContainerBorders = !! attributes.containerBorderType || - ( typeof attributes.containerBorderRadius !== 'undefined' && attributes.containerBorderRadius !== '' ) || - !! attributes.containerShadow - - if ( ! attributes.hasContainer && hasContainerBorders ) { - newAttributes = { - ...newAttributes, - hasContainer: true, - containerPadding: { - top: 0, right: 0, bottom: 0, left: 0, - }, - containerBackgroundColor: 'transparent', - } - } - // If the inner blocks are horizontal, adjust to accomodate the new // column gap, it will modify blocks because people used block // margins before instead of a proper column gap. diff --git a/src/block/testimonial/deprecated.js b/src/block/testimonial/deprecated.js index b026054bc..7dff7f4a8 100644 --- a/src/block/testimonial/deprecated.js +++ b/src/block/testimonial/deprecated.js @@ -60,25 +60,6 @@ const deprecated = [ } } - // Container borders while the container was turned off was allowed - // before, now it's not allowed. Turn on the container to mimic the - // effect. This goes first before the container paddings check below - // because we need to set the paddings to zero for this to work. - const hasContainerBorders = !! attributes.containerBorderType || - ( typeof attributes.containerBorderRadius !== 'undefined' && attributes.containerBorderRadius !== '' ) || - !! attributes.containerShadow - - if ( ! attributes.hasContainer && hasContainerBorders ) { - newAttributes = { - ...newAttributes, - hasContainer: true, - containerPadding: { - top: 0, right: 0, bottom: 0, left: 0, - }, - containerBackgroundColor: 'transparent', - } - } - // If the inner blocks are horizontal, adjust to accomodate the new // column gap, it will modify blocks because people used block // margins before instead of a proper column gap.