From 86e673404e87f373f91a38b460f91616ffdfa1e4 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 24 May 2022 14:06:59 -0400 Subject: [PATCH 1/3] Fix feature gating of Pleroma data imports --- app/soapbox/features/import_data/index.tsx | 5 +---- app/soapbox/features/ui/index.tsx | 2 +- app/soapbox/utils/features.ts | 6 ++++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/soapbox/features/import_data/index.tsx b/app/soapbox/features/import_data/index.tsx index b03b20f29..5d26fa0ec 100644 --- a/app/soapbox/features/import_data/index.tsx +++ b/app/soapbox/features/import_data/index.tsx @@ -6,8 +6,6 @@ import { importBlocks, importMutes, } from 'soapbox/actions/import_data'; -import { useAppSelector } from 'soapbox/hooks'; -import { getFeatures } from 'soapbox/utils/features'; import Column from '../ui/components/column'; @@ -38,13 +36,12 @@ const muteMessages = defineMessages({ const ImportData = () => { const intl = useIntl(); - const features = getFeatures(useAppSelector((state) => state.instance)); return ( - {features.importMutes && } + ); }; diff --git a/app/soapbox/features/ui/index.tsx b/app/soapbox/features/ui/index.tsx index 0ebb8f87a..948e5a5e2 100644 --- a/app/soapbox/features/ui/index.tsx +++ b/app/soapbox/features/ui/index.tsx @@ -287,7 +287,7 @@ const SwitchingColumnsArea: React.FC = ({ children }) => { - + {features.importData && } {features.accountAliasesAPI && } {features.accountMoving && } diff --git a/app/soapbox/utils/features.ts b/app/soapbox/utils/features.ts index e020456d1..e98b7262c 100644 --- a/app/soapbox/utils/features.ts +++ b/app/soapbox/utils/features.ts @@ -307,10 +307,12 @@ const getInstanceFeatures = (instance: Instance) => { importAPI: v.software === PLEROMA, /** - * Pleroma import mutes API. + * Pleroma import endpoints. + * @see POST /api/pleroma/follow_import + * @see POST /api/pleroma/blocks_import * @see POST /api/pleroma/mutes_import */ - importMutes: v.software === PLEROMA && gte(v.version, '2.2.0'), + importData: v.software === PLEROMA && gte(v.version, '2.2.0'), /** * Can create, view, and manage lists. From 8c00f5816244c199f22fb4347e70652f6854fe43 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 24 May 2022 14:14:22 -0400 Subject: [PATCH 2/3] Export: fix Mastodon fqn --- app/soapbox/actions/export_data.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/soapbox/actions/export_data.ts b/app/soapbox/actions/export_data.ts index de81215dd..b558c9e6e 100644 --- a/app/soapbox/actions/export_data.ts +++ b/app/soapbox/actions/export_data.ts @@ -1,8 +1,8 @@ import { defineMessages } from 'react-intl'; -import api, { getLinks } from '../api'; - -import snackbar from './snackbar'; +import snackbar from 'soapbox/actions/snackbar'; +import api, { getLinks } from 'soapbox/api'; +import { normalizeAccount } from 'soapbox/normalizers'; import type { SnackbarAction } from './snackbar'; import type { AxiosResponse } from 'axios'; @@ -60,7 +60,7 @@ const listAccounts = (getState: () => RootState) => async(apiResponse: AxiosResp Array.prototype.push.apply(followings, apiResponse.data); } - accounts = followings.map((account: { fqn: string }) => account.fqn); + accounts = followings.map((account: any) => normalizeAccount(account).fqn); return Array.from(new Set(accounts)); }; From 4873034206add786889b8018f15ffb2507238e87 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 24 May 2022 14:15:39 -0400 Subject: [PATCH 3/3] Disable exports for now --- app/soapbox/features/ui/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/soapbox/features/ui/index.tsx b/app/soapbox/features/ui/index.tsx index 948e5a5e2..dfdcfeb9f 100644 --- a/app/soapbox/features/ui/index.tsx +++ b/app/soapbox/features/ui/index.tsx @@ -84,7 +84,7 @@ import { EmailConfirmation, DeleteAccount, SoapboxConfig, - ExportData, + // ExportData, ImportData, // Backups, MfaForm, @@ -286,7 +286,8 @@ const SwitchingColumnsArea: React.FC = ({ children }) => { {features.scheduledStatuses && } - + {/* FIXME: this could DDoS our API? :\ */} + {/* */} {features.importData && } {features.accountAliasesAPI && } {features.accountMoving && }