diff options
author | Lain Iwakura <lain@soykaf.club> | 2017-11-14 16:24:10 +0100 |
---|---|---|
committer | Lain Iwakura <lain@soykaf.club> | 2017-11-14 16:24:10 +0100 |
commit | d11b1a1aa7a44e345f2458a712e6bbed85db267f (patch) | |
tree | 86ede1f4ad8e9925620e351ea80e6f6c87bac85b /app/javascript | |
parent | a4dcabc11beac5e1226157baf4242ce66a831d55 (diff) |
Handle character limit in initial state in frontend.
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/mastodon/features/compose/components/compose_form.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js index 7890755f3..1b64f7fc7 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.js +++ b/app/javascript/mastodon/features/compose/components/compose_form.js @@ -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> |