diff --git a/app/javascript/flavours/glitch/features/compose/components/character_counter.js b/app/javascript/flavours/glitch/features/compose/components/character_counter.js index 0ecfc9141..215048d7e 100644 --- a/app/javascript/flavours/glitch/features/compose/components/character_counter.js +++ b/app/javascript/flavours/glitch/features/compose/components/character_counter.js @@ -7,10 +7,14 @@ export default class CharacterCounter extends React.PureComponent { static propTypes = { text: PropTypes.string.isRequired, max: PropTypes.number.isRequired, + no_limit: PropTypes.bool.isRequired, }; checkRemainingText (diff) { - if (diff < 0) { + if (this.props.no_limit) { + return ; + } + else if (diff < 0) { return {diff}; } diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.js b/app/javascript/flavours/glitch/features/compose/components/compose_form.js index a4aade62e..b20b6bc47 100644 --- a/app/javascript/flavours/glitch/features/compose/components/compose_form.js +++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.js @@ -294,7 +294,8 @@ class ComposeForm extends ImmutablePureComponent { 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 (
@@ -357,7 +358,7 @@ class ComposeForm extends ImmutablePureComponent { spoiler={spoilersAlwaysOn ? (spoilerText && spoilerText.length > 0) : spoiler} />
- +
diff --git a/app/validators/status_length_validator.rb b/app/validators/status_length_validator.rb index 92ee5e643..9f4c8c662 100644 --- a/app/validators/status_length_validator.rb +++ b/app/validators/status_length_validator.rb @@ -4,6 +4,9 @@ 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 + 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? @status = status