forked from cybrespace/mastodon
Feature: 512-character limit in the toot box on client and serverside
This commit is contained in:
parent
7ac5151b74
commit
d6dd4a21ea
|
@ -80,7 +80,7 @@ export default class ComposeForm extends ImmutablePureComponent {
|
||||||
const { is_submitting, is_uploading, anyMedia } = this.props;
|
const { is_submitting, is_uploading, anyMedia } = this.props;
|
||||||
const fulltext = [this.props.spoiler_text, countableText(this.props.text)].join('');
|
const fulltext = [this.props.spoiler_text, countableText(this.props.text)].join('');
|
||||||
|
|
||||||
if (is_submitting || is_uploading || length(fulltext) > 500 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
|
if (is_submitting || is_uploading || length(fulltext) > 512 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ export default class ComposeForm extends ImmutablePureComponent {
|
||||||
const { intl, onPaste, showSearch, anyMedia } = this.props;
|
const { intl, onPaste, showSearch, anyMedia } = this.props;
|
||||||
const disabled = this.props.is_submitting;
|
const disabled = this.props.is_submitting;
|
||||||
const text = [this.props.spoiler_text, countableText(this.props.text)].join('');
|
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) > 512 || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
|
||||||
let publishText = '';
|
let publishText = '';
|
||||||
|
|
||||||
if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
|
if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
|
||||||
|
@ -208,7 +208,7 @@ export default class ComposeForm extends ImmutablePureComponent {
|
||||||
<SensitiveButtonContainer />
|
<SensitiveButtonContainer />
|
||||||
<SpoilerButtonContainer />
|
<SpoilerButtonContainer />
|
||||||
</div>
|
</div>
|
||||||
<div className='character-counter__wrapper'><CharacterCounter max={500} text={text} /></div>
|
<div className='character-counter__wrapper'><CharacterCounter max={512} text={text} /></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='compose-form__publish'>
|
<div className='compose-form__publish'>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class StatusLengthValidator < ActiveModel::Validator
|
class StatusLengthValidator < ActiveModel::Validator
|
||||||
MAX_CHARS = 500
|
MAX_CHARS = 512
|
||||||
|
|
||||||
def validate(status)
|
def validate(status)
|
||||||
return unless status.local? && !status.reblog?
|
return unless status.local? && !status.reblog?
|
||||||
|
|
Loading…
Reference in New Issue