Preferences: conditionally display post format (Markdown) settings
This commit is contained in:
parent
59e7c6538e
commit
5e6058489b
|
@ -5,6 +5,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import { getSettings, changeSetting } from 'soapbox/actions/settings';
|
import { getSettings, changeSetting } from 'soapbox/actions/settings';
|
||||||
|
import { getFeatures } from 'soapbox/utils/features';
|
||||||
import Column from '../ui/components/column';
|
import Column from '../ui/components/column';
|
||||||
import {
|
import {
|
||||||
SimpleForm,
|
SimpleForm,
|
||||||
|
@ -84,9 +85,14 @@ const messages = defineMessages({
|
||||||
display_media_show_all: { id: 'preferences.fields.display_media.show_all', defaultMessage: 'Always show media' },
|
display_media_show_all: { id: 'preferences.fields.display_media.show_all', defaultMessage: 'Always show media' },
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => {
|
||||||
|
const instance = state.get('instance');
|
||||||
|
|
||||||
|
return {
|
||||||
|
features: getFeatures(instance),
|
||||||
settings: getSettings(state),
|
settings: getSettings(state),
|
||||||
});
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export default @connect(mapStateToProps)
|
export default @connect(mapStateToProps)
|
||||||
@injectIntl
|
@injectIntl
|
||||||
|
@ -95,6 +101,7 @@ class Preferences extends ImmutablePureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
dispatch: PropTypes.func.isRequired,
|
dispatch: PropTypes.func.isRequired,
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
|
features: PropTypes.object.isRequired,
|
||||||
settings: ImmutablePropTypes.map,
|
settings: ImmutablePropTypes.map,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -115,7 +122,7 @@ class Preferences extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { settings, intl } = this.props;
|
const { settings, features, intl } = this.props;
|
||||||
|
|
||||||
const displayMediaOptions = {
|
const displayMediaOptions = {
|
||||||
default: intl.formatMessage(messages.display_media_default),
|
default: intl.formatMessage(messages.display_media_default),
|
||||||
|
@ -170,6 +177,7 @@ class Preferences extends ImmutablePureComponent {
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FieldsGroup>
|
</FieldsGroup>
|
||||||
|
|
||||||
|
{features.richText && (
|
||||||
<FieldsGroup>
|
<FieldsGroup>
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
label={<FormattedMessage id='preferences.fields.content_type_label' defaultMessage='Post format' />}
|
label={<FormattedMessage id='preferences.fields.content_type_label' defaultMessage='Post format' />}
|
||||||
|
@ -188,6 +196,7 @@ class Preferences extends ImmutablePureComponent {
|
||||||
/>
|
/>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FieldsGroup>
|
</FieldsGroup>
|
||||||
|
)}
|
||||||
|
|
||||||
<FieldsGroup>
|
<FieldsGroup>
|
||||||
<SettingsCheckbox
|
<SettingsCheckbox
|
||||||
|
|
Loading…
Reference in New Issue