From ca9f022a801be5573fb408d36431f93d2c53e209 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Mon, 2 Apr 2018 17:22:32 +0200 Subject: [PATCH] [Glitch] Fix: Prevent submission using same logic as submit button disabling. Port 6a895e1ab3d69cd018423460518a1e16307999ad to glitch-soc --- app/javascript/flavours/glitch/features/composer/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/javascript/flavours/glitch/features/composer/index.js b/app/javascript/flavours/glitch/features/composer/index.js index 792ed79a31..3aa283628e 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();