]> cat aescling's git repositories - mastodon.git/commitdiff
Hide content-type dropdown by default
authorThibaut Girka <thib@sitedethib.com>
Sun, 12 May 2019 19:55:44 +0000 (21:55 +0200)
committerThibG <thib@sitedethib.com>
Fri, 17 May 2019 21:51:14 +0000 (23:51 +0200)
app/javascript/flavours/glitch/features/compose/components/options.js
app/javascript/flavours/glitch/features/compose/containers/options_container.js
app/javascript/flavours/glitch/features/local_settings/page/index.js
app/javascript/flavours/glitch/reducers/local_settings.js

index 9bec36a7def8e560b6d28110893fa74bb60de335..0c94f55145ec0c403b48000baafcf0bafc2e47f7 100644 (file)
@@ -140,6 +140,7 @@ class ComposerOptions extends ImmutablePureComponent {
     contentType: PropTypes.string,
     resetFileKey: PropTypes.number,
     spoiler: PropTypes.bool,
+    showContentTypeChoice: PropTypes.bool,
   };
 
   //  Handles file selection.
@@ -197,6 +198,7 @@ class ComposerOptions extends ImmutablePureComponent {
       privacy,
       resetFileKey,
       spoiler,
+      showContentTypeChoice,
     } = this.props;
 
     //  We predefine our privacy items so that we can easily pick the
@@ -310,20 +312,22 @@ class ComposerOptions extends ImmutablePureComponent {
           title={intl.formatMessage(messages.change_privacy)}
           value={privacy}
         />
-        <Dropdown
-          disabled={disabled}
-          icon={(contentTypeItems[contentType.split('/')[1]] || {}).icon}
-          items={[
-            contentTypeItems.plain,
-            contentTypeItems.html,
-            contentTypeItems.markdown,
-          ]}
-          onChange={onChangeContentType}
-          onModalClose={onModalClose}
-          onModalOpen={onModalOpen}
-          title={intl.formatMessage(messages.content_type)}
-          value={contentType}
-        />
+        {showContentTypeChoice && (
+          <Dropdown
+            disabled={disabled}
+            icon={(contentTypeItems[contentType.split('/')[1]] || {}).icon}
+            items={[
+              contentTypeItems.plain,
+              contentTypeItems.html,
+              contentTypeItems.markdown,
+            ]}
+            onChange={onChangeContentType}
+            onModalClose={onModalClose}
+            onModalOpen={onModalOpen}
+            title={intl.formatMessage(messages.content_type)}
+            value={contentType}
+          />
+        )}
         {onToggleSpoiler && (
           <TextIconButton
             active={spoiler}
index 2ac7ab8d8d2d2e9777734081666a94626ea84791..a9ad3a5e83b603db29aa15c5aa8f54b0cbe9c106 100644 (file)
@@ -17,6 +17,7 @@ function mapStateToProps (state) {
     allowMedia: !poll && (media ? media.size < 4 && !media.some(item => item.get('type') === 'video') : true),
     hasMedia: media && !!media.size,
     allowPoll: !(media && !!media.size),
+    showContentTypeChoice: state.getIn(['local_settings', 'show_content_type_choice']),
   };
 };
 
index a13bffa3a219760afc83c59d00711c7fb119f5bd..cd2d867134065b97af5a71acfb62a592cd467ae5 100644 (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' />
         </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
           settings={settings}
           item={['side_arm']}
index 8dea4d8f68f960dd9a550459e0f423a8671c007d..5716c5982e5546f730bfd48dbc2c862ec6dc2442 100644 (file)
@@ -19,6 +19,7 @@ const initialState = ImmutableMap({
   preselect_on_reply: true,
   inline_preview_cards: true,
   hicolor_privacy_icons: false,
+  show_content_type_choice: false,
   content_warnings : ImmutableMap({
     auto_unfold : false,
     filter      : null,