Allow importing mutes
This commit is contained in:
parent
af50ad4639
commit
b5d0861bd1
|
@ -1,4 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
import { defineMessages, injectIntl } from 'react-intl';
|
import { defineMessages, injectIntl } from 'react-intl';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
@ -6,9 +7,10 @@ import Column from '../ui/components/column';
|
||||||
import {
|
import {
|
||||||
importFollows,
|
importFollows,
|
||||||
importBlocks,
|
importBlocks,
|
||||||
// importMutes,
|
importMutes,
|
||||||
} from 'soapbox/actions/import_data';
|
} from 'soapbox/actions/import_data';
|
||||||
import CSVImporter from './components/csv_importer';
|
import CSVImporter from './components/csv_importer';
|
||||||
|
import { getFeatures } from 'soapbox/utils/features';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
heading: { id: 'column.import_data', defaultMessage: 'Import data' },
|
heading: { id: 'column.import_data', defaultMessage: 'Import data' },
|
||||||
|
@ -27,28 +29,33 @@ const blockMessages = defineMessages({
|
||||||
submit: { id: 'import_data.actions.import_blocks', defaultMessage: 'Import blocks' },
|
submit: { id: 'import_data.actions.import_blocks', defaultMessage: 'Import blocks' },
|
||||||
});
|
});
|
||||||
|
|
||||||
// Not yet supported by Pleroma stable, in develop branch
|
const muteMessages = defineMessages({
|
||||||
// const muteMessages = defineMessages({
|
input_label: { id: 'import_data.mutes_label', defaultMessage: 'Mutes' },
|
||||||
// input_label: { id: 'import_data.mutes_label', defaultMessage: 'Mutes' },
|
input_hint: { id: 'import_data.hints.mutes', defaultMessage: 'CSV file containing a list of muted accounts' },
|
||||||
// input_hint: { id: 'import_data.hints.mutes', defaultMessage: 'CSV file containing a list of muted accounts' },
|
submit: { id: 'import_data.actions.import_mutes', defaultMessage: 'Import mutes' },
|
||||||
// submit: { id: 'import_data.actions.import_mutes', defaultMessage: 'Import mutes' },
|
});
|
||||||
// });
|
|
||||||
|
|
||||||
export default @injectIntl
|
const mapStateToProps = state => ({
|
||||||
|
features: getFeatures(state.get('instance')),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default @connect(mapStateToProps)
|
||||||
|
@injectIntl
|
||||||
class ImportData extends ImmutablePureComponent {
|
class ImportData extends ImmutablePureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
|
features: PropTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { intl } = this.props;
|
const { intl, features } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column icon='cloud-upload' heading={intl.formatMessage(messages.heading)} backBtnSlim>
|
<Column icon='cloud-upload' heading={intl.formatMessage(messages.heading)} backBtnSlim>
|
||||||
<CSVImporter action={importFollows} messages={followMessages} />
|
<CSVImporter action={importFollows} messages={followMessages} />
|
||||||
<CSVImporter action={importBlocks} messages={blockMessages} />
|
<CSVImporter action={importBlocks} messages={blockMessages} />
|
||||||
{/* <CSVImporter action={importMutes} messages={muteMessages} /> */}
|
{features.importMutes && <CSVImporter action={importMutes} messages={muteMessages} />}
|
||||||
</Column>
|
</Column>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ export const getFeatures = instance => {
|
||||||
emojiReacts: v.software === 'Pleroma' && gte(v.version, '2.0.0'),
|
emojiReacts: v.software === 'Pleroma' && gte(v.version, '2.0.0'),
|
||||||
attachmentLimit: v.software === 'Pleroma' ? Infinity : 4,
|
attachmentLimit: v.software === 'Pleroma' ? Infinity : 4,
|
||||||
focalPoint: v.software === 'Mastodon' && gte(v.compatVersion, '2.3.0'),
|
focalPoint: v.software === 'Mastodon' && gte(v.compatVersion, '2.3.0'),
|
||||||
|
importMutes: v.software === 'Pleroma' && gte(v.version, '2.2.0'),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue