]> cat aescling's git repositories - mastodon.git/commitdiff
Handle character limit in initial state in frontend.
authorLain Iwakura <lain@soykaf.club>
Tue, 14 Nov 2017 15:24:10 +0000 (16:24 +0100)
committerLain Iwakura <lain@soykaf.club>
Tue, 14 Nov 2017 15:24:10 +0000 (16:24 +0100)
app/javascript/mastodon/features/compose/components/compose_form.js

index 7890755f33db888dba4458ba83149770e1200568..1b64f7fc79ac51f5a1ed48b33b4de3805359e17e 100644 (file)
@@ -18,6 +18,8 @@ import { isMobile } from '../../../is_mobile';
 import ImmutablePureComponent from 'react-immutable-pure-component';
 import { length } from 'stringz';
 import { countableText } from '../util/counter';
+import initialState from '../../../initial_state';
+const maxChars = initialState.max_chars;
 
 const messages = defineMessages({
   placeholder: { id: 'compose_form.placeholder', defaultMessage: 'What is on your mind?' },
@@ -201,8 +203,8 @@ export default class ComposeForm extends ImmutablePureComponent {
           </div>
 
           <div className='compose-form__publish'>
-            <div className='character-counter__wrapper'><CharacterCounter max={500} text={text} /></div>
-            <div className='compose-form__publish-button-wrapper'><Button text={publishText} onClick={this.handleSubmit} disabled={disabled || this.props.is_uploading || length(text) > 500 || (text.length !== 0 && text.trim().length === 0)} block /></div>
+            <div className='character-counter__wrapper'><CharacterCounter max={maxChars} text={text} /></div>
+            <div className='compose-form__publish-button-wrapper'><Button text={publishText} onClick={this.handleSubmit} disabled={disabled || this.props.is_uploading || length(text) > maxChars || (text.length !== 0 && text.trim().length === 0)} block /></div>
           </div>
         </div>
       </div>