Increase toot length limit to 16384 when a CW is used
parent
edc31ca4a6
commit
f12bbf6948
|
@ -7,10 +7,14 @@ export default class CharacterCounter extends React.PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
text: PropTypes.string.isRequired,
|
text: PropTypes.string.isRequired,
|
||||||
max: PropTypes.number.isRequired,
|
max: PropTypes.number.isRequired,
|
||||||
|
no_limit: PropTypes.bool.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
checkRemainingText (diff) {
|
checkRemainingText (diff) {
|
||||||
if (diff < 0) {
|
if (this.props.no_limit) {
|
||||||
|
return <span className='character-counter'>∞</span>;
|
||||||
|
}
|
||||||
|
else if (diff < 0) {
|
||||||
return <span className='character-counter character-counter--over'>{diff}</span>;
|
return <span className='character-counter character-counter--over'>{diff}</span>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,8 @@ class ComposeForm extends ImmutablePureComponent {
|
||||||
|
|
||||||
let disabledButton = isSubmitting || isUploading || isChangingUpload || (!text.trim().length && !anyMedia);
|
let disabledButton = isSubmitting || isUploading || isChangingUpload || (!text.trim().length && !anyMedia);
|
||||||
|
|
||||||
const countText = `${spoilerText}${countableText(text)}${advancedOptions && advancedOptions.get('do_not_federate') ? ' 🐺' : ''}`;
|
const countText=spoilerText ? '∞' : `${spoilerText}${countableText(text)}${advancedOptions && advancedOptions.get('do_not_federate') ? ' 🐺': ''}`;
|
||||||
|
const no_limit = spoilerText != '';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='composer'>
|
<div className='composer'>
|
||||||
|
@ -357,7 +358,7 @@ class ComposeForm extends ImmutablePureComponent {
|
||||||
spoiler={spoilersAlwaysOn ? (spoilerText && spoilerText.length > 0) : spoiler}
|
spoiler={spoilersAlwaysOn ? (spoilerText && spoilerText.length > 0) : spoiler}
|
||||||
/>
|
/>
|
||||||
<div className='compose--counter-wrapper'>
|
<div className='compose--counter-wrapper'>
|
||||||
<CharacterCounter text={countText} max={maxChars} />
|
<CharacterCounter text={countText} max={maxChars} no_limit={no_limit} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,9 @@ class StatusLengthValidator < ActiveModel::Validator
|
||||||
MAX_CHARS = (ENV['MAX_TOOT_CHARS'] || 500).to_i
|
MAX_CHARS = (ENV['MAX_TOOT_CHARS'] || 500).to_i
|
||||||
|
|
||||||
def validate(status)
|
def validate(status)
|
||||||
|
status.errors.add(:text, "hard limit of 16k exceeded") if status.text.length > 16384
|
||||||
|
status.errors.add(:text, "CW can't be longer than 500 characters") if status.spoiler_text.length > 500
|
||||||
|
return unless status.spoiler_text.blank?
|
||||||
return unless status.local? && !status.reblog?
|
return unless status.local? && !status.reblog?
|
||||||
|
|
||||||
@status = status
|
@status = status
|
||||||
|
|
Loading…
Reference in New Issue