Skip to content

Commit

Permalink
change char limit
Browse files Browse the repository at this point in the history
  • Loading branch information
pullopen committed Jul 16, 2020
1 parent e6f7b26 commit 2bf275b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Expand Up @@ -88,7 +88,7 @@ class ComposeForm extends ImmutablePureComponent {
const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props;
const fulltext = [this.props.spoilerText, countableText(this.props.text)].join('');

if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > 5000 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
return;
}

Expand Down Expand Up @@ -181,7 +181,7 @@ class ComposeForm extends ImmutablePureComponent {
const { intl, onPaste, showSearch, anyMedia } = this.props;
const disabled = this.props.isSubmitting;
const text = [this.props.spoilerText, countableText(this.props.text)].join('');
const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > 500 || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > 5000 || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
let publishText = '';

if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
Expand Down Expand Up @@ -243,7 +243,7 @@ class ComposeForm extends ImmutablePureComponent {
<PrivacyDropdownContainer />
<SpoilerButtonContainer />
</div>
<div className='character-counter__wrapper'><CharacterCounter max={500} text={text} /></div>
<div className='character-counter__wrapper'><CharacterCounter max={5000} text={text} /></div>
</div>

<div className='compose-form__publish'>
Expand Down
6 changes: 5 additions & 1 deletion app/serializers/rest/instance_serializer.rb
Expand Up @@ -5,7 +5,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer

attributes :uri, :title, :short_description, :description, :email,
:version, :urls, :stats, :thumbnail,
:languages, :registrations, :approval_required, :invites_enabled
:languages, :registrations, :approval_required, :max_toot_chars, :invites_enabled

has_one :contact_account, serializer: REST::AccountSerializer

Expand Down Expand Up @@ -63,6 +63,10 @@ def approval_required
Setting.registrations_mode == 'approved'
end

def max_toot_chars
5000
end

def invites_enabled
Setting.min_invite_role == 'user'
end
Expand Down
2 changes: 1 addition & 1 deletion app/validators/status_length_validator.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class StatusLengthValidator < ActiveModel::Validator
MAX_CHARS = 500
MAX_CHARS = 5000

def validate(status)
return unless status.local? && !status.reblog?
Expand Down

0 comments on commit 2bf275b

Please sign in to comment.