From a6caf919e2d766bb924992943946cba915b17036 Mon Sep 17 00:00:00 2001 From: trwnh Date: Sun, 19 May 2019 15:51:44 -0500 Subject: [PATCH] Change bio limit from 160 to 500 (#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 --- app/models/account.rb | 2 +- app/views/settings/profiles/show.html.haml | 2 +- .../api/v1/accounts/credentials_controller_spec.rb | 2 +- spec/models/account_spec.rb | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/account.rb b/app/models/account.rb index a894d5be54..fe48fce105 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -75,7 +75,7 @@ class Account < ApplicationRecord validates_with UniqueUsernameValidator, if: -> { local? && will_save_change_to_username? } validates_with UnreservedUsernameValidator, if: -> { local? && will_save_change_to_username? } validates :display_name, length: { maximum: 30 }, if: -> { local? && will_save_change_to_display_name? } - validates :note, note_length: { maximum: 160 }, if: -> { local? && will_save_change_to_note? } + validates :note, note_length: { maximum: 500 }, if: -> { local? && will_save_change_to_note? } validates :fields, length: { maximum: 4 }, if: -> { local? && will_save_change_to_fields? } scope :remote, -> { where.not(domain: nil) } diff --git a/app/views/settings/profiles/show.html.haml b/app/views/settings/profiles/show.html.haml index eb232dc57b..8ffb018243 100644 --- a/app/views/settings/profiles/show.html.haml +++ b/app/views/settings/profiles/show.html.haml @@ -7,7 +7,7 @@ .fields-row .fields-row__column.fields-group.fields-row__column-6 = f.input :display_name, wrapper: :with_label, input_html: { maxlength: 30 }, hint: false - = f.input :note, wrapper: :with_label, input_html: { maxlength: 160 }, hint: false + = f.input :note, wrapper: :with_label, input_html: { maxlength: 500 }, hint: false .fields-row .fields-row__column.fields-row__column-6 diff --git a/spec/controllers/api/v1/accounts/credentials_controller_spec.rb b/spec/controllers/api/v1/accounts/credentials_controller_spec.rb index 7276698863..19ac326128 100644 --- a/spec/controllers/api/v1/accounts/credentials_controller_spec.rb +++ b/spec/controllers/api/v1/accounts/credentials_controller_spec.rb @@ -61,7 +61,7 @@ describe Api::V1::Accounts::CredentialsController do describe 'with invalid data' do before do - patch :update, params: { note: 'This is too long. ' * 10 } + patch :update, params: { note: 'This is too long. ' * 30 } end it 'returns http unprocessable entity' do diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index 46886b91f5..719e01de76 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -601,8 +601,8 @@ RSpec.describe Account, type: :model do expect(account).to model_have_error_on_field(:display_name) end - it 'is invalid if the note is longer than 160 characters' do - account = Fabricate.build(:account, note: Faker::Lorem.characters(161)) + it 'is invalid if the note is longer than 500 characters' do + account = Fabricate.build(:account, note: Faker::Lorem.characters(501)) account.valid? expect(account).to model_have_error_on_field(:note) end