Hide content-type dropdown by default

This commit is contained in:
Thibaut Girka 2019-05-12 21:55:44 +02:00 committed by ThibG
parent 76d58bf63e
commit dfeda8857f
4 changed files with 28 additions and 14 deletions

View file

@ -140,6 +140,7 @@ class ComposerOptions extends ImmutablePureComponent {
contentType: PropTypes.string, contentType: PropTypes.string,
resetFileKey: PropTypes.number, resetFileKey: PropTypes.number,
spoiler: PropTypes.bool, spoiler: PropTypes.bool,
showContentTypeChoice: PropTypes.bool,
}; };
// Handles file selection. // Handles file selection.
@ -197,6 +198,7 @@ class ComposerOptions extends ImmutablePureComponent {
privacy, privacy,
resetFileKey, resetFileKey,
spoiler, spoiler,
showContentTypeChoice,
} = this.props; } = this.props;
// We predefine our privacy items so that we can easily pick the // We predefine our privacy items so that we can easily pick the
@ -310,6 +312,7 @@ class ComposerOptions extends ImmutablePureComponent {
title={intl.formatMessage(messages.change_privacy)} title={intl.formatMessage(messages.change_privacy)}
value={privacy} value={privacy}
/> />
{showContentTypeChoice && (
<Dropdown <Dropdown
disabled={disabled} disabled={disabled}
icon={(contentTypeItems[contentType.split('/')[1]] || {}).icon} icon={(contentTypeItems[contentType.split('/')[1]] || {}).icon}
@ -324,6 +327,7 @@ class ComposerOptions extends ImmutablePureComponent {
title={intl.formatMessage(messages.content_type)} title={intl.formatMessage(messages.content_type)}
value={contentType} value={contentType}
/> />
)}
{onToggleSpoiler && ( {onToggleSpoiler && (
<TextIconButton <TextIconButton
active={spoiler} active={spoiler}

View file

@ -17,6 +17,7 @@ function mapStateToProps (state) {
allowMedia: !poll && (media ? media.size < 4 && !media.some(item => item.get('type') === 'video') : true), allowMedia: !poll && (media ? media.size < 4 && !media.some(item => item.get('type') === 'video') : true),
hasMedia: media && !!media.size, hasMedia: media && !!media.size,
allowPoll: !(media && !!media.size), allowPoll: !(media && !!media.size),
showContentTypeChoice: state.getIn(['local_settings', 'show_content_type_choice']),
}; };
}; };

View file

@ -151,6 +151,14 @@ export default class LocalSettingsPage extends React.PureComponent {
> >
<FormattedMessage id='settings.confirm_before_clearing_draft' defaultMessage='Show confirmation dialog before overwriting the message being composed' /> <FormattedMessage id='settings.confirm_before_clearing_draft' defaultMessage='Show confirmation dialog before overwriting the message being composed' />
</LocalSettingsPageItem> </LocalSettingsPageItem>
<LocalSettingsPageItem
settings={settings}
item={['show_content_type_choice']}
id='mastodon-settings--show_content_type_choice'
onChange={onChange}
>
<FormattedMessage id='settings.show_content_type_choice' defaultMessage='Show content-type choice when authoring toots' />
</LocalSettingsPageItem>
<LocalSettingsPageItem <LocalSettingsPageItem
settings={settings} settings={settings}
item={['side_arm']} item={['side_arm']}

View file

@ -19,6 +19,7 @@ const initialState = ImmutableMap({
preselect_on_reply: true, preselect_on_reply: true,
inline_preview_cards: true, inline_preview_cards: true,
hicolor_privacy_icons: false, hicolor_privacy_icons: false,
show_content_type_choice: false,
content_warnings : ImmutableMap({ content_warnings : ImmutableMap({
auto_unfold : false, auto_unfold : false,
filter : null, filter : null,