about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-04-02 14:42:09 -0500
committerGitHub <noreply@github.com>2018-04-02 14:42:09 -0500
commit1f5bdd8445f6ba192618288504b74c1df7c09ea6 (patch)
treeab300dd929b93d9bd3cc3af850b180803610a430 /app/javascript
parenteb39db7f93061c936fcb0bb24d5ba0c9a6186993 (diff)
parentca9f022a801be5573fb408d36431f93d2c53e209 (diff)
Merge pull request #410 from ThibG/glitch-soc/fixes/compose-disable
[Glitch] Fix: Prevent submission using same logic as submit button disabling
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/flavours/glitch/features/composer/index.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/features/composer/index.js b/app/javascript/flavours/glitch/features/composer/index.js
index 792ed79a3..3aa283628 100644
--- a/app/javascript/flavours/glitch/features/composer/index.js
+++ b/app/javascript/flavours/glitch/features/composer/index.js
@@ -150,6 +150,9 @@ const handlers = {
     const {
       onChangeText,
       onSubmit,
+      isSubmitting,
+      isUploading,
+      anyMedia,
       text,
     } = this.props;
 
@@ -159,6 +162,11 @@ const handlers = {
       onChangeText(value);
     }
 
+    // Submit disabled:
+    if (isSubmitting || isUploading || (!!text.length && !text.trim().length && !anyMedia)) {
+      return;
+    }
+
     //  Submits the status.
     if (onSubmit) {
       onSubmit();