Increase toot length limit to 16384 when a CW is used

thank you to @unascribed
master
noiob 2018-11-29 20:13:43 -08:00
parent 5d5a689b38
commit 02ac3025d7
3 changed files with 4 additions and 2 deletions

View File

@ -493,7 +493,7 @@ class Composer extends React.Component {
spoiler={spoilersAlwaysOn ? (spoilerText && spoilerText.length > 0) : spoiler}
/>
<ComposerPublisher
countText={`${spoilerText}${countableText(text)}${advancedOptions && advancedOptions.get('do_not_federate') ? ' 👁️' : ''}`}
countText={spoilerText ? '∞' : `${spoilerText}${countableText(text)}${advancedOptions && advancedOptions.get('do_not_federate') ? ' 🐺': ''}`}
disabled={disabledButton}
intl={intl}
onSecondarySubmit={handleSecondarySubmit}

View File

@ -46,7 +46,7 @@ export default function ComposerPublisher ({
// The result.
return (
<div className={computedClass}>
<span className='count'>{diff}</span>
<span className='count'>{countText === '∞' ? '∞' : diff}</span>
{sideArm && sideArm !== 'none' ? (
<Button
className='side_arm'

View File

@ -4,6 +4,8 @@ class StatusLengthValidator < ActiveModel::Validator
MAX_CHARS = (ENV['MAX_TOOT_CHARS'] || 500).to_i
def validate(status)
status.errors.add(:text, "hard limit of 16k exceeded") if status.text.length > 16384
return unless status.spoiler_text.blank?
return unless status.local? && !status.reblog?
status.errors.add(:text, I18n.t('statuses.over_character_limit', max: MAX_CHARS)) if too_long?(status)
end