Skip to content
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

Social: Hide license link on Social admin page of WoA sites #41076

Merged
merged 5 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 4 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: changed

License: Social admin page header hides license link on WoA sites.
1 change: 1 addition & 0 deletions projects/js-packages/script-data/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface PublicSiteData {
export interface AdminSiteData {
admin_url: string;
date_format: string;
host: 'woa' | 'atomic' | 'newspack' | 'vip' | 'wpcom' | 'unknown';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us make this optional as it actually is from the backend.

Suggested change
host: 'woa' | 'atomic' | 'newspack' | 'vip' | 'wpcom' | 'unknown';
host?: 'woa' | 'atomic' | 'newspack' | 'vip' | 'wpcom' | 'unknown';

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In practice everything in AdminSiteData is optional since it's included in the JetpackScriptData interface using Partial< ... >.

But perhaps this makes it clearer that this property is even more optional than the other optional properties.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, thanks. I am fine with both.

is_multisite: boolean;
plan: SitePlan;
rest_nonce: string;
Expand Down
4 changes: 4 additions & 0 deletions projects/packages/publicize/changelog/hide-license-on-woa
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

License: Social admin page header hides license link on WoA sites.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions projects/plugins/social/changelog/hide-license-on-woa
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

License: Social admin page header hides license link on WoA sites.
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -14,7 +14,7 @@ const AdminPageHeader = () => {
<Logo />
</span>

{ ! hasSocialPaidFeatures() && (
{ ! hasSocialPaidFeatures() && getScriptData().site.host !== 'woa' && (
<p>
{ createInterpolateElement(
__(
Expand Down
Loading