Skip to content

WoA: Clarify function names and comments related to checking for WoA sites #43481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: added

Janitorial: Ensure functionality related to WoA site checking is clearer.
5 changes: 4 additions & 1 deletion projects/js-packages/script-data/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export function isSimpleSite() {

/**
* Check if the is an Atomic site.
* This does not include WoA, but does include the likes of Jurassic Ninja, Pressable, Bluehost on Atomic.
*
* @return {boolean} Whether the site is an Atomic site.
*/
Expand All @@ -90,7 +91,8 @@ export function isAtomicSite() {
}

/**
* Check if the site is a WoA site
* Check if the site is a WoA site.
* For WoA only - not general Atomic (see isAtomicSite()).
*
* @return Whether the site is woa.
*/
Expand All @@ -111,6 +113,7 @@ export function isWpcomPlatformSite() {

/**
* Check if the site is self-hosted Jetpack site.
* Will return false if the site is Atomic, for example Jurassic Ninja, Pressable, Bluehost on Atomic.
*
* @return {boolean} Whether the site is self-hosted Jetpack site.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: added

Janitorial: Ensure functionality related to WoA site checking is clearer.
10 changes: 10 additions & 0 deletions projects/js-packages/shared-extension-utils/src/site-type-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ export function isAtomicSite() {
return getSiteType() === 'atomic';
}

/**
* Check if environment is a WoA site.
* Replacement function for isAtomicSite.
*
* @return {boolean} True for WoA sites.
*/
export function isWoASite() {
return getSiteType() === 'atomic';
}

/**
* Return whether the current blog is set to private. (if blog_public option is -1)
*
Expand Down
8 changes: 4 additions & 4 deletions projects/plugins/jetpack/_inc/client/at-a-glance/akismet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { getJetpackProductUpsellByFeature, FEATURE_SPAM_AKISMET_PLUS } from 'lib
import { getProductDescriptionUrl } from 'product-descriptions/utils';
import { getAkismetData } from 'state/at-a-glance';
import { isOfflineMode, connectUser } from 'state/connection';
import { getApiNonce, isAtomicSite } from 'state/initial-state';
import { getApiNonce, isWoASite } from 'state/initial-state';
import { siteHasFeature } from 'state/site';

class DashAkismet extends Component {
Expand Down Expand Up @@ -93,8 +93,8 @@ class DashAkismet extends Component {
'Comments and contact form submissions are checked against our global database of spam.',
'jetpack'
),
// Hide the action link from Atomic sites because it promotes purchase of Jetpack product
link: this.props.isAtomicSite ? null : 'https://akismet.com/features',
// Hide the action link from WoA sites because it promotes purchase of Jetpack product
link: this.props.isWoASite ? null : 'https://akismet.com/features',
privacyLink: 'https://automattic.com/privacy/',
};

Expand Down Expand Up @@ -248,7 +248,7 @@ export default connect(
state => {
return {
akismetData: getAkismetData( state ),
isAtomicSite: isAtomicSite( state ),
isWoASite: isWoASite( state ),
isOfflineMode: isOfflineMode( state ),
upgradeUrl: getProductDescriptionUrl( state, 'akismet' ),
nonce: getApiNonce( state ),
Expand Down
6 changes: 3 additions & 3 deletions projects/plugins/jetpack/_inc/client/at-a-glance/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { withModuleSettingsFormHelpers } from 'components/module-settings/with-m
import analytics from 'lib/analytics';
import { isOfflineMode, hasConnectedOwner, getConnectionStatus } from 'state/connection';
import {
isAtomicSite,
isWoASite,
getApiNonce,
getApiRootUrl,
getPartnerCoupon,
Expand Down Expand Up @@ -104,7 +104,7 @@ class AtAGlance extends Component {
// Backup won't work with multi-sites, but Scan does if VaultPress is enabled
const hasVaultPressScanning =
! this.props.fetchingScanStatus && this.props.scanStatus?.reason === 'vp_active_on_site';
if ( ! this.props.isAtomicSite && ( ! this.props.multisite || hasVaultPressScanning ) ) {
if ( ! this.props.isWoASite && ( ! this.props.multisite || hasVaultPressScanning ) ) {
securityCards.push(
<DashScan
{ ...settingsProps }
Expand Down Expand Up @@ -262,7 +262,7 @@ export default connect( state => {
userCanViewStats: userCanViewStats( state ),
userCanManagePlugins: userCanManagePlugins( state ),
userIsSubscriber: userIsSubscriber( state ),
isAtomicSite: isAtomicSite( state ),
isWoASite: isWoASite( state ),
isOfflineMode: isOfflineMode( state ),
getModuleOverride: module_name => getModuleOverride( state, module_name ),
isModuleAvailable: module_name => isModuleAvailable( state, module_name ),
Expand Down
6 changes: 3 additions & 3 deletions projects/plugins/jetpack/_inc/client/at-a-glance/scan.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
isOfflineMode,
connectUser,
} from 'state/connection';
import { isAtomicSite, showBackups } from 'state/initial-state';
import { isWoASite, showBackups } from 'state/initial-state';
import { getScanStatus, isFetchingScanStatus } from 'state/scan';
import { getSitePlan, isFetchingSiteData } from 'state/site';
import { isPluginInstalled } from 'state/site/plugins';
Expand Down Expand Up @@ -285,7 +285,7 @@ class DashScan extends Component {
}

renderAction( url, message ) {
if ( this.props.isAtomicSite ) {
if ( this.props.isWoASite ) {
return null;
}

Expand Down Expand Up @@ -437,7 +437,7 @@ export default connect(
const sitePlan = getSitePlan( state );

return {
isAtomicSite: isAtomicSite( state ),
isWoASite: isWoASite( state ),
isOfflineMode: isOfflineMode( state ),
scanStatus: getScanStatus( state ),
fetchingScanStatus: isFetchingScanStatus( state ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
isOdysseyStatsEnabled,
getInitialStateStatsData,
getDateFormat,
isAtomicSite,
isWoASite,
} from 'state/initial-state';
import { isModuleAvailable, getModuleOverride } from 'state/modules';
import { emptyStatsCardDismissed } from 'state/settings';
Expand Down Expand Up @@ -400,7 +400,7 @@ export default connect(
isEmptyStatsCardDismissed: emptyStatsCardDismissed( state ),
getModuleOverride: module_name => getModuleOverride( state, module_name ),
isOdysseyStatsEnabled: isOdysseyStatsEnabled( state ),
isAtomicSite: isAtomicSite( state ),
isWoASite: isWoASite( state ),
} ),
dispatch => ( {
switchView: tab => dispatch( statsSwitchTab( tab ) ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
hasConnectedOwner,
} from 'state/connection';
import {
isAtomicSite,
isWoASite,
isDevVersion,
userCanConnectAccount,
userCanConnectSite,
Expand Down Expand Up @@ -272,7 +272,7 @@ export default connect(
isConnectionOwner: isConnectionOwner( state ),
isLinked: isCurrentUserLinked( state ),
isDevVersion: isDevVersion( state ),
isAtomicSite: isAtomicSite( state ),
isWoASite: isWoASite( state ),
siteOfflineMode: getSiteOfflineMode( state ),
isInIdentityCrisis: isInIdentityCrisis( state ),
connectionErrors: getConnectionErrors( state ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
isConnectionOwner,
connectUser,
} from 'state/connection';
import { isAtomicSite, isDevVersion as _isDevVersion, getUpgradeUrl } from 'state/initial-state';
import { isWoASite, isDevVersion as _isDevVersion, getUpgradeUrl } from 'state/initial-state';
import { siteHasFeature, hasActiveProductPurchase, isFetchingSiteData } from 'state/site';

class SupportCard extends React.Component {
Expand Down Expand Up @@ -83,15 +83,15 @@ class SupportCard extends React.Component {
? sprintf(
/* translators: placeholder is either Jetpack or WordPress.com */
__( 'Your paid plan gives you access to prioritized %s support.', 'jetpack' ),
this.props.isAtomicSite ? 'WordPress.com' : 'Jetpack'
this.props.isWoASite ? 'WordPress.com' : 'Jetpack'
)
: __(
'Jetpack offers support via community forums for any site without a paid product.',
'jetpack'
) }
</p>
<p className="jp-support-card__description">
{ this.props.isAtomicSite || (
{ this.props.isWoASite || (
<Button
onClick={ this.trackGettingStartedClick }
href={ getRedirectUrl( 'jetpack-support-getting-started' ) }
Expand All @@ -103,7 +103,7 @@ class SupportCard extends React.Component {
<Button
onClick={ this.trackSearchClick }
href={
this.props.isAtomicSite
this.props.isWoASite
? getRedirectUrl( 'calypso-help' )
: getRedirectUrl( 'jetpack-support' )
}
Expand Down Expand Up @@ -151,7 +151,7 @@ export default connect(
return {
siteConnectionStatus: getSiteConnectionStatus( state ),
isFetchingSiteData: isFetchingSiteData( state ),
isAtomicSite: isAtomicSite( state ),
isWoASite: isWoASite( state ),
isDevVersion: _isDevVersion( state ),
supportUpgradeUrl: getUpgradeUrl( state, 'support' ),
isCurrentUserLinked: isCurrentUserLinked( state ),
Expand Down
2 changes: 1 addition & 1 deletion projects/plugins/jetpack/_inc/client/earn/ads.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export const Ads = withModuleSettingsFormHelpers(
'Enables a targeted advertising opt-out link in US states where this is legally required.',
'jetpack'
),
link: this.props.isAtomicSite
link: this.props.isWoASite
? getRedirectUrl( 'wpcom-support-us-privacy' )
: getRedirectUrl( 'jetpack-support-ads' ),
} }
Expand Down
4 changes: 2 additions & 2 deletions projects/plugins/jetpack/_inc/client/earn/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
isOfflineMode,
isUnavailableInOfflineMode as isUnavailableInOfflineModeSelector,
} from 'state/connection';
import { isAtomicSite as isAtomicSiteSelector, getSiteId } from 'state/initial-state';
import { isWoASite as isWoASiteSelector, getSiteId } from 'state/initial-state';
import { getModule } from 'state/modules';
import { isModuleFound as isModuleFoundSelector } from 'state/search';
import { Ads } from './ads';
Expand Down Expand Up @@ -205,7 +205,7 @@ export default connect( state => {
isModuleFound: module_name => isModuleFoundSelector( state, module_name ),
isUnavailableInOfflineMode: module_name =>
isUnavailableInOfflineModeSelector( state, module_name ),
isAtomicSite: isAtomicSiteSelector( state ),
isWoASite: isWoASiteSelector( state ),
blogID: getSiteId( state ),
};
} )( Earn );
4 changes: 1 addition & 3 deletions projects/plugins/jetpack/_inc/client/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ import {
getInitialRecommendationsStep,
getPluginBaseUrl,
getPartnerCoupon,
isAtomicSite,
isWoASite,
showMyJetpack,
isWooCommerceActive,
Expand Down Expand Up @@ -676,7 +675,7 @@ class Main extends React.Component {
this.props.userCanConnectSite &&
site_count >= 2 &&
this.props.isSiteConnected &&
! this.props.isAtomicSite &&
! this.props.isWoaSite &&
! this.shouldShowWooConnectionScreen() &&
dashboardRoutes.includes( this.props.location.pathname )
);
Expand Down Expand Up @@ -913,7 +912,6 @@ export default connect(
connectUrl: getConnectUrl( state ),
connectingUserFeatureLabel: getConnectingUserFeatureLabel( state ),
connectingUserFrom: getConnectingUserFrom( state ),
isAtomicSite: isAtomicSite( state ),
isWoaSite: isWoASite( state ),
showMyJetpack: showMyJetpack( state ),
isWooCommerceActive: isWooCommerceActive( state ),
Expand Down
6 changes: 3 additions & 3 deletions projects/plugins/jetpack/_inc/client/sharing/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
getSiteRawUrl,
getSiteAdminUrl,
userCanManageModules,
isAtomicSite,
isWoASite,
isSharingBlockAvailable,
getSiteId,
} from 'state/initial-state';
Expand All @@ -40,7 +40,7 @@ class Sharing extends Component {
siteAdminUrl: this.props.siteAdminUrl,
userCanManageModules: this.props.userCanManageModules,
activeFeatures: this.props.activeFeatures,
isAtomicSite: this.props.isAtomicSite,
isWoASite: this.props.isWoASite,
hasSharingBlock: this.props.hasSharingBlock,
isBlockTheme: this.props.isBlockTheme,
};
Expand Down Expand Up @@ -92,7 +92,7 @@ export default connect( state => {
siteAdminUrl: getSiteAdminUrl( state ),
activeFeatures: getActiveFeatures( state ),
userCanManageModules: userCanManageModules( state ),
isAtomicSite: isAtomicSite( state ),
isWoASite: isWoASite( state ),
hasSharingBlock: isSharingBlockAvailable( state ),
isBlockTheme: currentThemeIsBlockTheme( state ),
};
Expand Down
Loading
Loading