Skip to content

Commit fc15b2b

Browse files
trwnhGargron
authored andcommitted
Change bio limit from 160 to 500 (mastodon#10790)
* Change note_length validator from 160 to 500 * Change input maxlength from 160 to 500 * update bio test from 160 to 500 * Multiply a string 30 times instead of 10
1 parent 9236119 commit fc15b2b

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

app/models/account.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Account < ApplicationRecord
7575
validates_with UniqueUsernameValidator, if: -> { local? && will_save_change_to_username? }
7676
validates_with UnreservedUsernameValidator, if: -> { local? && will_save_change_to_username? }
7777
validates :display_name, length: { maximum: 30 }, if: -> { local? && will_save_change_to_display_name? }
78-
validates :note, note_length: { maximum: 160 }, if: -> { local? && will_save_change_to_note? }
78+
validates :note, note_length: { maximum: 500 }, if: -> { local? && will_save_change_to_note? }
7979
validates :fields, length: { maximum: 4 }, if: -> { local? && will_save_change_to_fields? }
8080

8181
scope :remote, -> { where.not(domain: nil) }

app/views/settings/profiles/show.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
.fields-row
88
.fields-row__column.fields-group.fields-row__column-6
99
= f.input :display_name, wrapper: :with_label, input_html: { maxlength: 30 }, hint: false
10-
= f.input :note, wrapper: :with_label, input_html: { maxlength: 160 }, hint: false
10+
= f.input :note, wrapper: :with_label, input_html: { maxlength: 500 }, hint: false
1111

1212
.fields-row
1313
.fields-row__column.fields-row__column-6

spec/controllers/api/v1/accounts/credentials_controller_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161

6262
describe 'with invalid data' do
6363
before do
64-
patch :update, params: { note: 'This is too long. ' * 10 }
64+
patch :update, params: { note: 'This is too long. ' * 30 }
6565
end
6666

6767
it 'returns http unprocessable entity' do

spec/models/account_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,8 @@
601601
expect(account).to model_have_error_on_field(:display_name)
602602
end
603603

604-
it 'is invalid if the note is longer than 160 characters' do
605-
account = Fabricate.build(:account, note: Faker::Lorem.characters(161))
604+
it 'is invalid if the note is longer than 500 characters' do
605+
account = Fabricate.build(:account, note: Faker::Lorem.characters(501))
606606
account.valid?
607607
expect(account).to model_have_error_on_field(:note)
608608
end

0 commit comments

Comments
 (0)