From 4bc5fe17b62584de13a3e01c81961b912191879f Mon Sep 17 00:00:00 2001 From: Kevin L <40267301+a8ck3n@users.noreply.github.com> Date: Fri, 10 Jan 2025 09:13:02 +0800 Subject: [PATCH] Enable Subscribers tab for self-hosted (#98144) --- client/blocks/stats-navigation/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/blocks/stats-navigation/index.js b/client/blocks/stats-navigation/index.js index 4e9b0bb792733..4e75fd1f88240 100644 --- a/client/blocks/stats-navigation/index.js +++ b/client/blocks/stats-navigation/index.js @@ -21,6 +21,7 @@ import siteHasFeature from 'calypso/state/selectors/site-has-feature'; import { getJetpackStatsAdminVersion, getSiteOption, + isJetpackSite, isSimpleSite, } from 'calypso/state/sites/selectors'; import getSiteAdminUrl from 'calypso/state/sites/selectors/get-site-admin-url'; @@ -67,6 +68,7 @@ class StatsNavigation extends Component { isWordAds: PropTypes.bool, isSubscriptionsModuleActive: PropTypes.bool, isSimple: PropTypes.bool, + isSiteJetpackNotAtomic: PropTypes.bool, hasVideoPress: PropTypes.bool, selectedItem: PropTypes.oneOf( Object.keys( navItems ) ).isRequired, siteId: PropTypes.number, @@ -146,6 +148,7 @@ class StatsNavigation extends Component { isWordAds, isSubscriptionsModuleActive, isSimple, + isSiteJetpackNotAtomic, siteId, } = this.props; @@ -168,7 +171,10 @@ class StatsNavigation extends Component { return false; } - return isSimple || isSubscriptionsModuleActive; + // The value of isSubscriptionsModuleActive is null in Odyssey Stats so we default to showing the tab. + // Maintains existing behaviour inside wp-admin for self-hosted sites. + // For DotCom sites, it will only be shown on Simple sites or if subs are enabled. + return isSiteJetpackNotAtomic || isSimple || isSubscriptionsModuleActive; default: return true; @@ -313,6 +319,7 @@ export default connect( canCurrentUser( state, siteId, 'manage_options' ), isSubscriptionsModuleActive: isJetpackModuleActive( state, siteId, 'subscriptions' ), isSimple: isSimpleSite( state, siteId ), + isSiteJetpackNotAtomic: isJetpackSite( state, siteId, { treatAtomicAsJetpackSite: false } ), hasVideoPress: siteHasFeature( state, siteId, 'videopress' ), siteId, pageModuleToggles: getModuleToggles( state, siteId, [ selectedItem ] ),