logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe
commit: db136f95105ea1e0a7a2a295d4aa67ee112d39c8
parent: e3cc42e42fb52c90ace190c4ea7713d6c36020ea
Author: Morgan Bazalgette <the@howl.moe>
Date:   Fri, 30 Mar 2018 01:00:40 +0200

Get charLimit from the initial state

Diffstat:

Mapp/javascript/mastodon/features/compose/components/compose_form.js5+++--
Mapp/javascript/mastodon/initial_state.js1+
2 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 @@ -18,6 +18,7 @@ import { isMobile } from '../../../is_mobile'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { length } from 'stringz'; import { countableText } from '../util/counter'; +import { charLimit } from "../../../initial_state" const messages = defineMessages({ placeholder: { id: 'compose_form.placeholder', defaultMessage: 'What is on your mind?' }, @@ -146,7 +147,7 @@ export default class ComposeForm extends ImmutablePureComponent { const { intl, onPaste, showSearch, anyMedia } = this.props; const disabled = this.props.is_submitting; const text = [this.props.spoiler_text, countableText(this.props.text)].join(''); - const disabledButton = disabled || this.props.is_uploading || length(text) > 500 || (text.length !== 0 && text.trim().length === 0 && !anyMedia); + const disabledButton = disabled || this.props.is_uploading || length(text) > charLimit || (text.length !== 0 && text.trim().length === 0 && !anyMedia); let publishText = ''; if (this.props.privacy === 'private' || this.props.privacy === 'direct') { @@ -200,7 +201,7 @@ export default class ComposeForm extends ImmutablePureComponent { <SensitiveButtonContainer /> <SpoilerButtonContainer /> </div> - <div className='character-counter__wrapper'><CharacterCounter max={500} text={text} /></div> + <div className='character-counter__wrapper'><CharacterCounter max={charLimit} text={text} /></div> </div> <div className='compose-form__publish'> diff --git a/app/javascript/mastodon/initial_state.js b/app/javascript/mastodon/initial_state.js @@ -11,5 +11,6 @@ export const boostModal = getMeta('boost_modal'); export const deleteModal = getMeta('delete_modal'); export const me = getMeta('me'); export const searchEnabled = getMeta('search_enabled'); +export const charLimit = getMeta('char_limit') || 5000; export default initialState;