From be0d34b70a68be77cab2ca38fef42aea645b21a9 Mon Sep 17 00:00:00 2001 From: Philip Jackson Date: Thu, 16 Jan 2025 09:50:25 +1300 Subject: [PATCH] Social: Hide license link on Social admin page of WoA sites (#41076) * Add JetpackScriptData.site.host property * Hide license link on Social admin page of WoA sites --- .../js-packages/script-data/changelog/hide-license-on-woa | 4 ++++ projects/js-packages/script-data/src/types.ts | 1 + projects/packages/publicize/changelog/hide-license-on-woa | 4 ++++ .../packages/publicize/src/class-publicize-script-data.php | 3 +++ projects/plugins/social/changelog/hide-license-on-woa | 4 ++++ .../social/src/js/components/admin-page/header/index.jsx | 4 ++-- 6 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 projects/js-packages/script-data/changelog/hide-license-on-woa create mode 100644 projects/packages/publicize/changelog/hide-license-on-woa create mode 100644 projects/plugins/social/changelog/hide-license-on-woa diff --git a/projects/js-packages/script-data/changelog/hide-license-on-woa b/projects/js-packages/script-data/changelog/hide-license-on-woa new file mode 100644 index 0000000000000..4a91af7a3d646 --- /dev/null +++ b/projects/js-packages/script-data/changelog/hide-license-on-woa @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +License: Social admin page header hides license link on WoA sites. diff --git a/projects/js-packages/script-data/src/types.ts b/projects/js-packages/script-data/src/types.ts index f42b25e27bd05..03d420fdfe7cd 100644 --- a/projects/js-packages/script-data/src/types.ts +++ b/projects/js-packages/script-data/src/types.ts @@ -18,6 +18,7 @@ export interface PublicSiteData { export interface AdminSiteData { admin_url: string; date_format: string; + host?: 'woa' | 'atomic' | 'newspack' | 'vip' | 'wpcom' | 'unknown'; is_multisite: boolean; plan: SitePlan; rest_nonce: string; diff --git a/projects/packages/publicize/changelog/hide-license-on-woa b/projects/packages/publicize/changelog/hide-license-on-woa new file mode 100644 index 0000000000000..4a91af7a3d646 --- /dev/null +++ b/projects/packages/publicize/changelog/hide-license-on-woa @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +License: Social admin page header hides license link on WoA sites. diff --git a/projects/packages/publicize/src/class-publicize-script-data.php b/projects/packages/publicize/src/class-publicize-script-data.php index 6f18e8b9b696d..89ffe9f3131ba 100644 --- a/projects/packages/publicize/src/class-publicize-script-data.php +++ b/projects/packages/publicize/src/class-publicize-script-data.php @@ -71,6 +71,9 @@ public static function set_admin_script_data( $data ) { $data['site']['wpcom']['blog_id'] = Manager::get_site_id( true ); $data['site']['suffix'] = ( new Status() )->get_site_suffix(); + if ( ! isset( $data['site']['host'] ) ) { + $data['site']['host'] = ( new Host() )->get_known_host_guess(); + } return $data; } diff --git a/projects/plugins/social/changelog/hide-license-on-woa b/projects/plugins/social/changelog/hide-license-on-woa new file mode 100644 index 0000000000000..4a91af7a3d646 --- /dev/null +++ b/projects/plugins/social/changelog/hide-license-on-woa @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +License: Social admin page header hides license link on WoA sites. diff --git a/projects/plugins/social/src/js/components/admin-page/header/index.jsx b/projects/plugins/social/src/js/components/admin-page/header/index.jsx index 31e52ebf1bd64..2aa32878a9553 100644 --- a/projects/plugins/social/src/js/components/admin-page/header/index.jsx +++ b/projects/plugins/social/src/js/components/admin-page/header/index.jsx @@ -1,5 +1,5 @@ import { hasSocialPaidFeatures } from '@automattic/jetpack-publicize-components'; -import { getMyJetpackUrl } from '@automattic/jetpack-script-data'; +import { getMyJetpackUrl, getScriptData } from '@automattic/jetpack-script-data'; import { createInterpolateElement } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import Logo from './../../logo'; @@ -14,7 +14,7 @@ const AdminPageHeader = () => { - { ! hasSocialPaidFeatures() && ( + { ! hasSocialPaidFeatures() && getScriptData().site.host !== 'woa' && (

{ createInterpolateElement( __(