From db5796cc08906f59bdd02664fb717efd0f0091f6 Mon Sep 17 00:00:00 2001 From: Will Howard Date: Wed, 25 Jan 2023 14:38:23 +0000 Subject: [PATCH 1/2] Updated conditional logic to display radio button fields on GiftArticle. --- .../src/RadioButtonsSection.jsx | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/components/x-gift-article/src/RadioButtonsSection.jsx b/components/x-gift-article/src/RadioButtonsSection.jsx index 2d3771537..8911cd8dc 100644 --- a/components/x-gift-article/src/RadioButtonsSection.jsx +++ b/components/x-gift-article/src/RadioButtonsSection.jsx @@ -73,7 +73,8 @@ export default ({ ) - if (!isFreeArticle || enterpriseEnabled) { + // If the article is free and Enterprise Sharing is enabled, display the radio buttons. + if (isFreeArticle && enterpriseEnabled) { return (
Article share options - {isFreeArticle ? ( + {freeToReadField()} + {enterpriseField()} +
+ ) + } + + // If the article is not free, display the radio buttons with conditional options depending + // on whether or not Enterprise Sharing is enabled. + if (!isFreeArticle) { + return ( +
+ + Article share options + + {enterpriseEnabled ? (
- {freeToReadField()} {enterpriseField()} + {giftField()} + {nonGiftField()}
) : (
- {enterpriseField()} {giftField()} {nonGiftField()}
@@ -99,5 +118,6 @@ export default ({ ) } + // If the article is free but Enterprise Sharing is NOT enabled, do not display the radio buttons. return null } From 2383f5520ee69f06f19cd7ec361863d695974c0f Mon Sep 17 00:00:00 2001 From: Will Howard Date: Wed, 25 Jan 2023 14:44:03 +0000 Subject: [PATCH 2/2] Tweaked code comment. --- components/x-gift-article/src/RadioButtonsSection.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/components/x-gift-article/src/RadioButtonsSection.jsx b/components/x-gift-article/src/RadioButtonsSection.jsx index 8911cd8dc..5c0977fbf 100644 --- a/components/x-gift-article/src/RadioButtonsSection.jsx +++ b/components/x-gift-article/src/RadioButtonsSection.jsx @@ -119,5 +119,6 @@ export default ({ } // If the article is free but Enterprise Sharing is NOT enabled, do not display the radio buttons. + // They're not required because there's only one available sharing option in this case. return null }