From 03adc44709b14e4a98f2c6a0ad33ecbb1cb0b643 Mon Sep 17 00:00:00 2001
From: Matt Wiebe
Date: Mon, 2 Dec 2024 16:13:39 -0600
Subject: [PATCH] Fediverse: remove support for Jetpack/Atomic sites (#96989)
---
.../JetpackFediverseSettingsSection.js | 55 ------------------
.../WpcomFediverseSettingsSection.js | 48 ++++++----------
.../fediverse-settings/index.jsx | 56 -------------------
.../settings-discussion/main.jsx | 2 -
.../connections/services/fediverse.jsx | 43 ++++++--------
client/sites/marketing/style.scss | 4 ++
6 files changed, 40 insertions(+), 168 deletions(-)
delete mode 100644 client/my-sites/site-settings/fediverse-settings/JetpackFediverseSettingsSection.js
delete mode 100644 client/my-sites/site-settings/fediverse-settings/index.jsx
diff --git a/client/my-sites/site-settings/fediverse-settings/JetpackFediverseSettingsSection.js b/client/my-sites/site-settings/fediverse-settings/JetpackFediverseSettingsSection.js
deleted file mode 100644
index 268012dc399744..00000000000000
--- a/client/my-sites/site-settings/fediverse-settings/JetpackFediverseSettingsSection.js
+++ /dev/null
@@ -1,55 +0,0 @@
-import page from '@automattic/calypso-router';
-import { Card, Button } from '@automattic/components';
-import { useTranslate } from 'i18n-calypso';
-import { useSelector } from 'react-redux';
-import QueryPlugins from 'calypso/components/data/query-plugins';
-import { getPluginOnSite } from 'calypso/state/plugins/installed/selectors';
-import { getSiteDomain, getSiteAdminUrl } from 'calypso/state/sites/selectors';
-
-function Wrapper( { children, needsCard } ) {
- return needsCard ? { children } : children;
-}
-
-export const JetpackFediverseSettingsSection = ( { siteId, needsBorders } ) => {
- const translate = useTranslate();
- const domain = useSelector( ( state ) => getSiteDomain( state, siteId ) );
- const plugin = useSelector( ( state ) => getPluginOnSite( state, siteId, 'activitypub' ) );
- const adminUrl = useSelector( ( state ) =>
- getSiteAdminUrl( state, siteId, 'options-general.php?page=activitypub' )
- );
- const pluginIsActive = plugin?.active;
- const pluginIsInstalledAndInactive = plugin && ! pluginIsActive;
-
- return (
- <>
-
-
-
- { translate(
- 'Broadcast your blog into the fediverse! Attract followers, deliver updates, and receive comments from a diverse user base of ActivityPub-compliant platforms.'
- ) }
-
-
- { pluginIsActive ? (
- <>
- { translate( 'ActivityPub is already enabled for your site!' ) }
-
- { translate( '{{link}}Manage ActivityPub settings{{/link}}', {
- components: {
- link: ,
- },
- } ) }
-
- >
- ) : (
- page( `/plugins/activitypub/${ domain }` ) }>
- { pluginIsInstalledAndInactive
- ? translate( 'Activate ActivityPub' )
- : translate( 'Install ActivityPub' ) }
-
- ) }
-
-
- >
- );
-};
diff --git a/client/my-sites/site-settings/fediverse-settings/WpcomFediverseSettingsSection.js b/client/my-sites/site-settings/fediverse-settings/WpcomFediverseSettingsSection.js
index c8557b1d5780ec..cc756845f15145 100644
--- a/client/my-sites/site-settings/fediverse-settings/WpcomFediverseSettingsSection.js
+++ b/client/my-sites/site-settings/fediverse-settings/WpcomFediverseSettingsSection.js
@@ -1,5 +1,5 @@
import { getPlan, PLAN_BUSINESS } from '@automattic/calypso-products';
-import { Card, Button } from '@automattic/components';
+import { Button } from '@automattic/components';
import { ToggleControl } from '@wordpress/components';
import { addQueryArgs } from '@wordpress/url';
import { useTranslate } from 'i18n-calypso';
@@ -19,15 +19,7 @@ import {
getSitePlanSlug,
} from 'calypso/state/sites/selectors';
-function Wrapper( { children, needsCard } ) {
- return needsCard ? (
- { children }
- ) : (
- { children }
- );
-}
-
-const DomainUpsellCard = ( { siteId, needsCard } ) => {
+const DomainUpsellCard = ( { siteId } ) => {
const domain = useSelector( ( state ) => getSiteDomain( state, siteId ) );
const linkUrl = addQueryArgs( domainAddNew( domain ), {
domainAndPlanPackage: 'true',
@@ -40,7 +32,7 @@ const DomainUpsellCard = ( { siteId, needsCard } ) => {
recordTracksEvent( 'calypso_activitypub_domain_upsell_click', { route: currentRoute } );
};
return (
-
+
{ translate(
'Unlock the full power of the fediverse with a memorable custom domain. Your domain also means that you can take your followers with you, using self-hosted WordPress with the ActivityPub plugin, or any other ActivityPub software.'
@@ -49,7 +41,7 @@ const DomainUpsellCard = ( { siteId, needsCard } ) => {
{ translate( 'Add a custom domain' ) }
-
+
);
};
@@ -96,7 +88,7 @@ const DomainPendingWarning = ( { siteId, domains } ) => {
);
};
-const BusinessPlanUpsellCard = ( { siteId, needsCard } ) => {
+const BusinessPlanUpsellCard = ( { siteId } ) => {
const sitePlanSlug = useSelector( ( state ) => getSitePlanSlug( state, siteId ) ?? '' );
// If the user is already on Atomic, we'll be in `JetpackFediverseSettingsSection` instead.
// But they could have purchased the upgrade and not have transferred yet.
@@ -113,7 +105,7 @@ const BusinessPlanUpsellCard = ( { siteId, needsCard } ) => {
if ( isBusinessPlan ) {
// show a card that links to the plugin page to install the ActivityPub plugin
return (
-
+
{ translate(
'Install the ActivityPub plugin to unlock per-author profiles, fine-grained controls, and more.'
@@ -122,11 +114,11 @@ const BusinessPlanUpsellCard = ( { siteId, needsCard } ) => {
{ translate( 'Install ActivityPub plugin' ) }
-
+
);
}
return (
-
+
{ translate(
// Translators: %(planName)s is the name of a plan, eg "Business" or "Creator"
@@ -137,7 +129,7 @@ const BusinessPlanUpsellCard = ( { siteId, needsCard } ) => {
{ translate( 'Upgrade to %(planName)s', { args: { planName } } ) }
-
+
);
};
@@ -152,7 +144,7 @@ const hasPendingDomain = ( domains ) => {
return pendingDomain;
};
-const EnabledSettingsSection = ( { data, siteId, needsCard } ) => {
+const EnabledSettingsSection = ( { data, siteId } ) => {
const translate = useTranslate();
const domains = useSiteDomains( siteId );
const { blogIdentifier = '' } = data;
@@ -162,8 +154,8 @@ const EnabledSettingsSection = ( { data, siteId, needsCard } ) => {
return (
<>
- { ! hasDomain && }
-
+ { ! hasDomain && }
+
{ translate(
'People on the Fediverse (such as on Mastodon) can follow your site using this identifier:'
@@ -173,10 +165,8 @@ const EnabledSettingsSection = ( { data, siteId, needsCard } ) => {
-
- { hasDomain && ! isDomainPending && (
-
- ) }
+
+ { hasDomain && ! isDomainPending && }
>
);
};
@@ -186,7 +176,7 @@ function useDispatchSuccessNotice() {
return ( message ) => dispatch( successNotice( message, { duration: 3333 } ) );
}
-export const WpcomFediverseSettingsSection = ( { siteId, needsBorders = true } ) => {
+export const WpcomFediverseSettingsSection = ( { siteId } ) => {
const translate = useTranslate();
const dispatchSuccessNotice = useDispatchSuccessNotice();
const siteTitle = useSelector( ( state ) => getSiteTitle( state, siteId ) );
@@ -214,7 +204,7 @@ export const WpcomFediverseSettingsSection = ( { siteId, needsBorders = true } )
: baseSettingsLink;
return (
<>
-
+
{ translate(
'Broadcast your blog into the fediverse! Attract followers, deliver updates, and receive comments from a diverse user base of ActivityPub-compliant platforms like {{b}}Mastodon{{/b}}.',
@@ -240,10 +230,8 @@ export const WpcomFediverseSettingsSection = ( { siteId, needsBorders = true } )
} ) }
) }
-
- { isEnabled && (
-
- ) }
+
+ { isEnabled && }
>
);
};
diff --git a/client/my-sites/site-settings/fediverse-settings/index.jsx b/client/my-sites/site-settings/fediverse-settings/index.jsx
deleted file mode 100644
index 49f5c03b4a3e94..00000000000000
--- a/client/my-sites/site-settings/fediverse-settings/index.jsx
+++ /dev/null
@@ -1,56 +0,0 @@
-import { Card } from '@automattic/components';
-import { useTranslate } from 'i18n-calypso';
-import { useSelector } from 'react-redux';
-import SettingsSectionHeader from 'calypso/my-sites/site-settings/settings-section-header';
-import { getSiteDomain } from 'calypso/state/sites/selectors';
-import isJetpackSite from 'calypso/state/sites/selectors/is-jetpack-site';
-import { getSelectedSiteId } from 'calypso/state/ui/selectors';
-import { JetpackFediverseSettingsSection } from './JetpackFediverseSettingsSection';
-import { WpcomFediverseSettingsSection } from './WpcomFediverseSettingsSection';
-
-export const FediverseServiceSection = ( { needsBorders = true } ) => {
- const siteId = useSelector( getSelectedSiteId );
- const isJetpack = useSelector( ( state ) => isJetpackSite( state, siteId ) );
-
- return (
- <>
- { isJetpack ? (
-
- ) : (
-
- ) }
- >
- );
-};
-
-export const FediverseSettingsSection = () => {
- const translate = useTranslate();
-
- return (
- <>
-
-
- >
- );
-};
-
-export const FediverseDeprecatedDiscussionSection = () => {
- const translate = useTranslate();
- const siteId = useSelector( getSelectedSiteId );
- const domain = useSelector( ( state ) => getSiteDomain( state, siteId ) );
-
- return (
- <>
-
-
-
- { translate( 'Fediverse settings now live in {{link}}Marketing Connections{{/link}}.', {
- components: {
- link: ,
- },
- } ) }
-
-
- >
- );
-};
diff --git a/client/my-sites/site-settings/settings-discussion/main.jsx b/client/my-sites/site-settings/settings-discussion/main.jsx
index afe22f047436e4..403c3c1fb6cf76 100644
--- a/client/my-sites/site-settings/settings-discussion/main.jsx
+++ b/client/my-sites/site-settings/settings-discussion/main.jsx
@@ -4,7 +4,6 @@ import DocumentHead from 'calypso/components/data/document-head';
import InlineSupportLink from 'calypso/components/inline-support-link';
import Main from 'calypso/components/main';
import NavigationHeader from 'calypso/components/navigation-header';
-import { FediverseDeprecatedDiscussionSection } from 'calypso/my-sites/site-settings/fediverse-settings';
import DiscussionForm from 'calypso/my-sites/site-settings/form-discussion';
import JetpackDevModeNotice from 'calypso/my-sites/site-settings/jetpack-dev-mode-notice';
import SiteSettingsNavigation from 'calypso/my-sites/site-settings/navigation';
@@ -29,7 +28,6 @@ const SiteSettingsDiscussion = ( { site, translate } ) => (
/>
-
);
diff --git a/client/sites/marketing/connections/services/fediverse.jsx b/client/sites/marketing/connections/services/fediverse.jsx
index 9cc6ef841bb7c3..4dec35d1bf19ec 100644
--- a/client/sites/marketing/connections/services/fediverse.jsx
+++ b/client/sites/marketing/connections/services/fediverse.jsx
@@ -1,15 +1,24 @@
import { Badge, FoldableCard } from '@automattic/components';
import { useTranslate } from 'i18n-calypso';
import { useSelector } from 'react-redux';
-import QueryPlugins from 'calypso/components/data/query-plugins';
import SocialLogo from 'calypso/components/social-logo';
-import { FediverseServiceSection } from 'calypso/my-sites/site-settings/fediverse-settings';
+import { WpcomFediverseSettingsSection } from 'calypso/my-sites/site-settings/fediverse-settings/WpcomFediverseSettingsSection';
import { useActivityPubStatus } from 'calypso/state/activitypub/use-activitypub-status';
-import { getPluginOnSite } from 'calypso/state/plugins/installed/selectors';
import { getSite } from 'calypso/state/sites/selectors';
import isJetpackSite from 'calypso/state/sites/selectors/is-jetpack-site';
import { getSelectedSiteId } from 'calypso/state/ui/selectors';
+const FediverseServiceSection = () => {
+ const siteId = useSelector( getSelectedSiteId );
+ const isJetpack = useSelector( ( state ) => isJetpackSite( state, siteId ) );
+
+ if ( isJetpack ) {
+ return null;
+ }
+
+ return ;
+};
+
function FediverseHeader() {
const translate = useTranslate();
return (
@@ -28,26 +37,9 @@ function FediverseHeader() {
);
}
-function JetpackFediverseStatus( { siteId } ) {
- const translate = useTranslate();
- const plugin = useSelector( ( state ) => getPluginOnSite( state, siteId, 'activitypub' ) );
- const pluginIsActive = plugin?.active;
- const pluginIsInstalledAndInactive = plugin && ! pluginIsActive;
- return (
- <>
-
- { ( ! plugin || pluginIsInstalledAndInactive ) && (
- { translate( 'Inactive' ) }
- ) }
- { pluginIsActive && { translate( 'Enabled' ) } }
- >
- );
-}
-
function FediverseStatus() {
const translate = useTranslate();
const siteId = useSelector( getSelectedSiteId );
- const isJetpack = useSelector( ( state ) => isJetpackSite( state, siteId ) );
const site = useSelector( ( state ) => getSite( state, siteId ) );
const isPrivate = site?.is_private || site?.is_coming_soon;
const { isEnabled, isLoading, isError } = useActivityPubStatus( siteId );
@@ -57,10 +49,6 @@ function FediverseStatus() {
return null;
}
- if ( isJetpack ) {
- return ;
- }
-
return isEnabled ? (
{ translate( 'Enabled' ) }
) : (
@@ -69,6 +57,11 @@ function FediverseStatus() {
}
export default function Fediverse() {
+ const siteId = useSelector( getSelectedSiteId );
+ const isJetpack = useSelector( ( state ) => isJetpackSite( state, siteId ) );
+ if ( isJetpack ) {
+ return null;
+ }
return (
-
+
);
diff --git a/client/sites/marketing/style.scss b/client/sites/marketing/style.scss
index 6bbca521644ce1..c29b5c828f899e 100644
--- a/client/sites/marketing/style.scss
+++ b/client/sites/marketing/style.scss
@@ -129,6 +129,10 @@
display: flex;
}
}
+.sharing-service--fediverse .notice.is-compact {
+ margin-left: 0;
+ margin-right: 0;
+}
.buttons__sharing-settings,
.connections__sharing-settings {