From 1107aa027d433681c4cfd4c7e00e7cc4c85c6ca9 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 30 Mar 2020 16:47:22 -0500 Subject: [PATCH] Fix max_toot_chars --- .../features/compose/components/compose_form.js | 9 ++++----- app/gabsocial/initial_state.js | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/gabsocial/features/compose/components/compose_form.js b/app/gabsocial/features/compose/components/compose_form.js index fb82cf21f..6e145ecec 100644 --- a/app/gabsocial/features/compose/components/compose_form.js +++ b/app/gabsocial/features/compose/components/compose_form.js @@ -21,9 +21,8 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import { length } from 'stringz'; import { countableText } from '../util/counter'; import Icon from 'gabsocial/components/icon'; -import initialState from '../../../initial_state'; +import { maxTootChars } from '../../../initial_state'; -const maxChars = initialState.max_toot_chars; const allowedAroundShortCode = '><\u0085\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\u0009\u000a\u000b\u000c\u000d'; const messages = defineMessages({ @@ -117,7 +116,7 @@ class ComposeForm extends ImmutablePureComponent { const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props; const fulltext = [this.props.spoilerText, countableText(this.props.text)].join(''); - if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxChars || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) { + if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxTootChars || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) { return; } @@ -204,7 +203,7 @@ class ComposeForm extends ImmutablePureComponent { const condensed = shouldCondense && !this.props.text && !this.state.composeFocused; const disabled = this.props.isSubmitting; const text = [this.props.spoilerText, countableText(this.props.text)].join(''); - const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > maxChars || (text.length !== 0 && text.trim().length === 0 && !anyMedia); + const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > maxTootChars || (text.length !== 0 && text.trim().length === 0 && !anyMedia); const shouldAutoFocus = autoFocus && !showSearch && !isMobile(window.innerWidth) let publishText = ''; @@ -281,7 +280,7 @@ class ComposeForm extends ImmutablePureComponent { -
+
} diff --git a/app/gabsocial/initial_state.js b/app/gabsocial/initial_state.js index 1d1ba3fb7..1b6f0bb5f 100644 --- a/app/gabsocial/initial_state.js +++ b/app/gabsocial/initial_state.js @@ -28,5 +28,6 @@ export const forceSingleColumn = !getMeta('advanced_layout'); export const funding = getMeta('funding'); export const promoItems = getMeta('promo_items'); export const unreadCount = getMeta('unread_count'); +export const maxTootChars = getMeta('max_toot_chars'); export default initialState;