Fix feature gating of Pleroma data imports

This commit is contained in:
Alex Gleason 2022-05-24 14:06:59 -04:00
parent 5bfec696d9
commit 86e673404e
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
3 changed files with 6 additions and 7 deletions

View file

@ -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>
); );
}; };

View file

@ -287,7 +287,7 @@ const SwitchingColumnsArea: React.FC = ({ 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} /> <WrappedRoute path='/settings/export' page={DefaultPage} component={ExportData} content={children} />
<WrappedRoute path='/settings/import' page={DefaultPage} component={ImportData} 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} />

View file

@ -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.