Show error when submitting empty post rather than failing silently (#36650)

This commit is contained in:
diondiondion
2025-10-30 20:29:25 +01:00
committed by Claire
parent e4291e9b05
commit 214d59bd37
3 changed files with 14 additions and 4 deletions

View File

@@ -123,11 +123,10 @@ class ComposeForm extends ImmutablePureComponent {
};
canSubmit = () => {
const { isSubmitting, isChangingUpload, isUploading, anyMedia, maxChars } = this.props;
const { isSubmitting, isChangingUpload, isUploading, maxChars } = this.props;
const fulltext = this.getFulltextForCharacterCounting();
const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;
return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxChars || (isOnlyWhitespace && !anyMedia));
return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxChars);
};
handleSubmit = (e) => {