diff --git a/app/soapbox/features/preferences/index.js b/app/soapbox/features/preferences/index.js index a5a05a54d..2a28d9137 100644 --- a/app/soapbox/features/preferences/index.js +++ b/app/soapbox/features/preferences/index.js @@ -5,6 +5,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { getSettings, changeSetting } from 'soapbox/actions/settings'; +import { getFeatures } from 'soapbox/utils/features'; import Column from '../ui/components/column'; import { SimpleForm, @@ -84,9 +85,14 @@ const messages = defineMessages({ display_media_show_all: { id: 'preferences.fields.display_media.show_all', defaultMessage: 'Always show media' }, }); -const mapStateToProps = state => ({ - settings: getSettings(state), -}); +const mapStateToProps = state => { + const instance = state.get('instance'); + + return { + features: getFeatures(instance), + settings: getSettings(state), + }; +}; export default @connect(mapStateToProps) @injectIntl @@ -95,6 +101,7 @@ class Preferences extends ImmutablePureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, + features: PropTypes.object.isRequired, settings: ImmutablePropTypes.map, }; @@ -115,7 +122,7 @@ class Preferences extends ImmutablePureComponent { } render() { - const { settings, intl } = this.props; + const { settings, features, intl } = this.props; const displayMediaOptions = { default: intl.formatMessage(messages.display_media_default), @@ -170,24 +177,26 @@ class Preferences extends ImmutablePureComponent { - - } - onChange={this.onDefaultContentTypeChange} - > - } - checked={settings.get('defaultContentType') === 'text/plain'} - value='text/plain' - /> - } - hint={} - checked={settings.get('defaultContentType') === 'text/markdown'} - value='text/markdown' - /> - - + {features.richText && ( + + } + onChange={this.onDefaultContentTypeChange} + > + } + checked={settings.get('defaultContentType') === 'text/plain'} + value='text/plain' + /> + } + hint={} + checked={settings.get('defaultContentType') === 'text/markdown'} + value='text/markdown' + /> + + + )}