Merge branch 'gate-imports' into 'develop'
Fix feature gating of Pleroma data imports See merge request soapbox-pub/soapbox-fe!1446
This commit is contained in:
commit
7902908504
4 changed files with 13 additions and 13 deletions
|
@ -1,8 +1,8 @@
|
||||||
import { defineMessages } from 'react-intl';
|
import { defineMessages } from 'react-intl';
|
||||||
|
|
||||||
import api, { getLinks } from '../api';
|
import snackbar from 'soapbox/actions/snackbar';
|
||||||
|
import api, { getLinks } from 'soapbox/api';
|
||||||
import snackbar from './snackbar';
|
import { normalizeAccount } from 'soapbox/normalizers';
|
||||||
|
|
||||||
import type { SnackbarAction } from './snackbar';
|
import type { SnackbarAction } from './snackbar';
|
||||||
import type { AxiosResponse } from 'axios';
|
import type { AxiosResponse } from 'axios';
|
||||||
|
@ -60,7 +60,7 @@ const listAccounts = (getState: () => RootState) => async(apiResponse: AxiosResp
|
||||||
Array.prototype.push.apply(followings, apiResponse.data);
|
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));
|
return Array.from(new Set(accounts));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@ import {
|
||||||
importBlocks,
|
importBlocks,
|
||||||
importMutes,
|
importMutes,
|
||||||
} from 'soapbox/actions/import_data';
|
} from 'soapbox/actions/import_data';
|
||||||
import { useAppSelector } from 'soapbox/hooks';
|
|
||||||
import { getFeatures } from 'soapbox/utils/features';
|
|
||||||
|
|
||||||
import Column from '../ui/components/column';
|
import Column from '../ui/components/column';
|
||||||
|
|
||||||
|
@ -38,13 +36,12 @@ const muteMessages = defineMessages({
|
||||||
|
|
||||||
const ImportData = () => {
|
const ImportData = () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const features = getFeatures(useAppSelector((state) => state.instance));
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column icon='cloud-upload-alt' label={intl.formatMessage(messages.heading)}>
|
<Column icon='cloud-upload-alt' label={intl.formatMessage(messages.heading)}>
|
||||||
<CSVImporter action={importFollows} messages={followMessages} />
|
<CSVImporter action={importFollows} messages={followMessages} />
|
||||||
<CSVImporter action={importBlocks} messages={blockMessages} />
|
<CSVImporter action={importBlocks} messages={blockMessages} />
|
||||||
{features.importMutes && <CSVImporter action={importMutes} messages={muteMessages} />}
|
<CSVImporter action={importMutes} messages={muteMessages} />
|
||||||
</Column>
|
</Column>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -84,7 +84,7 @@ import {
|
||||||
EmailConfirmation,
|
EmailConfirmation,
|
||||||
DeleteAccount,
|
DeleteAccount,
|
||||||
SoapboxConfig,
|
SoapboxConfig,
|
||||||
ExportData,
|
// ExportData,
|
||||||
ImportData,
|
ImportData,
|
||||||
// Backups,
|
// Backups,
|
||||||
MfaForm,
|
MfaForm,
|
||||||
|
@ -286,8 +286,9 @@ const SwitchingColumnsArea: React.FC = ({ children }) => {
|
||||||
{features.scheduledStatuses && <WrappedRoute path='/scheduled_statuses' page={DefaultPage} component={ScheduledStatuses} content={children} />}
|
{features.scheduledStatuses && <WrappedRoute path='/scheduled_statuses' page={DefaultPage} component={ScheduledStatuses} content={children} />}
|
||||||
|
|
||||||
<WrappedRoute path='/settings/profile' page={DefaultPage} component={EditProfile} content={children} />
|
<WrappedRoute path='/settings/profile' page={DefaultPage} component={EditProfile} content={children} />
|
||||||
<WrappedRoute path='/settings/export' page={DefaultPage} component={ExportData} content={children} />
|
{/* FIXME: this could DDoS our API? :\ */}
|
||||||
<WrappedRoute path='/settings/import' page={DefaultPage} component={ImportData} content={children} />
|
{/* <WrappedRoute path='/settings/export' page={DefaultPage} component={ExportData} content={children} /> */}
|
||||||
|
{features.importData && <WrappedRoute path='/settings/import' page={DefaultPage} component={ImportData} content={children} />}
|
||||||
{features.accountAliasesAPI && <WrappedRoute path='/settings/aliases' page={DefaultPage} component={Aliases} content={children} />}
|
{features.accountAliasesAPI && <WrappedRoute path='/settings/aliases' page={DefaultPage} component={Aliases} content={children} />}
|
||||||
{features.accountMoving && <WrappedRoute path='/settings/migration' page={DefaultPage} component={Migration} content={children} />}
|
{features.accountMoving && <WrappedRoute path='/settings/migration' page={DefaultPage} component={Migration} content={children} />}
|
||||||
<WrappedRoute path='/settings/email' page={DefaultPage} component={EditEmail} content={children} />
|
<WrappedRoute path='/settings/email' page={DefaultPage} component={EditEmail} content={children} />
|
||||||
|
|
|
@ -307,10 +307,12 @@ const getInstanceFeatures = (instance: Instance) => {
|
||||||
importAPI: v.software === PLEROMA,
|
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
|
* @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.
|
* Can create, view, and manage lists.
|
||||||
|
|
Loading…
Reference in a new issue