Skip to content

Commit

Permalink
Increase hardcoded limits.
Browse files Browse the repository at this point in the history
- Post length 500 -> 1500
- Poll options 4 -> 10
- Poll option length 50 -> 100
- Account note 500 -> 1000
  • Loading branch information
virtulis committed Sep 19, 2023
1 parent abcc0b3 commit 7f60974
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class ComposeForm extends ImmutablePureComponent {
const fulltext = this.getFulltextForCharacterCounting();
const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;

return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (isOnlyWhitespace && !anyMedia));
return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 1500 || (isOnlyWhitespace && !anyMedia));
};

handleSubmit = (e) => {
Expand Down Expand Up @@ -297,7 +297,7 @@ class ComposeForm extends ImmutablePureComponent {
</div>

<div className='character-counter__wrapper'>
<CharacterCounter max={500} text={this.getFulltextForCharacterCounting()} />
<CharacterCounter max={1500} text={this.getFulltextForCharacterCounting()} />
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class OptionIntl extends PureComponent {

<AutosuggestInput
placeholder={intl.formatMessage(messages.option_placeholder, { number: index + 1 })}
maxLength={50}
maxLength={100}
value={title}
lang={lang}
spellCheck
Expand Down Expand Up @@ -164,7 +164,7 @@ class PollForm extends ImmutablePureComponent {
</ul>

<div className='poll__footer'>
<button type='button' disabled={options.size >= 4} className='button button-secondary' onClick={this.handleAddOption}><Icon id='plus' /> <FormattedMessage {...messages.add_option} /></button>
<button type='button' disabled={options.size >= 10} className='button button-secondary' onClick={this.handleAddOption}><Icon id='plus' /> <FormattedMessage {...messages.add_option} /></button>

{/* eslint-disable-next-line jsx-a11y/no-onchange */}
<select value={expiresIn} onChange={this.handleSelectDuration}>
Expand Down
2 changes: 1 addition & 1 deletion app/models/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class Account < ApplicationRecord
validates :username, format: { with: /\A[a-z0-9_]+\z/i }, length: { maximum: 30 }, if: -> { local? && will_save_change_to_username? && actor_type != 'Application' }
validates_with UnreservedUsernameValidator, if: -> { local? && will_save_change_to_username? && actor_type != 'Application' }
validates :display_name, length: { maximum: 30 }, if: -> { local? && will_save_change_to_display_name? }
validates :note, note_length: { maximum: 500 }, if: -> { local? && will_save_change_to_note? }
validates :note, note_length: { maximum: 1000 }, if: -> { local? && will_save_change_to_note? }
validates :fields, length: { maximum: 4 }, if: -> { local? && will_save_change_to_fields? }
validates :uri, absence: true, if: :local?, on: :create
validates :inbox_url, absence: true, if: :local?, on: :create
Expand Down
4 changes: 2 additions & 2 deletions app/validators/poll_validator.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

class PollValidator < ActiveModel::Validator
MAX_OPTIONS = 4
MAX_OPTION_CHARS = 50
MAX_OPTIONS = 10
MAX_OPTION_CHARS = 100
MAX_EXPIRATION = 1.month.freeze
MIN_EXPIRATION = 5.minutes.freeze

Expand Down
2 changes: 1 addition & 1 deletion app/validators/status_length_validator.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class StatusLengthValidator < ActiveModel::Validator
MAX_CHARS = 500
MAX_CHARS = 1500
URL_PLACEHOLDER_CHARS = 23
URL_PLACEHOLDER = 'x' * 23

Expand Down

0 comments on commit 7f60974

Please sign in to comment.