about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features
diff options
context:
space:
mode:
authorGô Shoemake <marrus-sh@users.noreply.github.com>2018-03-12 13:09:42 -0700
committerGitHub <noreply@github.com>2018-03-12 13:09:42 -0700
commit22f2750578c64af4e886b0cc704aa0be4ee209b0 (patch)
treee78dcbda318956c4d642a3bd16f23b3862cb6113 /app/javascript/flavours/glitch/features
parent2395a4c31323e5c1433fbf232cd6c52e516a72f5 (diff)
parent841ef606a9b1bc3390830643606b3ec9d65d5120 (diff)
Merge pull request #384 from ThibG/glitch-soc/features/no-media-url
Remove text requirement when media attached from statuses (fixes #381)
Diffstat (limited to 'app/javascript/flavours/glitch/features')
-rw-r--r--app/javascript/flavours/glitch/features/composer/index.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/composer/index.js b/app/javascript/flavours/glitch/features/composer/index.js
index e50f3ec3f..792ed79a3 100644
--- a/app/javascript/flavours/glitch/features/composer/index.js
+++ b/app/javascript/flavours/glitch/features/composer/index.js
@@ -73,6 +73,7 @@ function mapStateToProps (state) {
     suggestionToken: state.getIn(['compose', 'suggestion_token']),
     suggestions: state.getIn(['compose', 'suggestions']),
     text: state.getIn(['compose', 'text']),
+    anyMedia: state.getIn(['compose', 'media_attachments']).size > 0,
   };
 };
 
@@ -272,6 +273,7 @@ class Composer extends React.Component {
       acceptContentTypes,
       advancedOptions,
       amUnlocked,
+      anyMedia,
       intl,
       isSubmitting,
       isUploading,
@@ -305,6 +307,8 @@ class Composer extends React.Component {
       text,
     } = this.props;
 
+    let disabledButton = isSubmitting || isUploading || (!!text.length && !text.trim().length && !anyMedia);
+
     return (
       <div className='composer'>
         <ComposerSpoiler
@@ -374,7 +378,7 @@ class Composer extends React.Component {
         />
         <ComposerPublisher
           countText={`${spoilerText}${countableText(text)}${advancedOptions && advancedOptions.get('do_not_federate') ? ' 👁️' : ''}`}
-          disabled={isSubmitting || isUploading || !!text.length && !text.trim().length}
+          disabled={disabledButton}
           intl={intl}
           onSecondarySubmit={handleSecondarySubmit}
           onSubmit={handleSubmit}
@@ -436,6 +440,7 @@ Composer.propTypes = {
   onUndoUpload: PropTypes.func,
   onUnmount: PropTypes.func,
   onUpload: PropTypes.func,
+  anyMedia: PropTypes.bool,
 };
 
 //  Connecting and export.