Raise various string limits.

staging
multiple creatures 2019-04-18 17:32:58 -05:00
parent 1fe28ca9d6
commit 9753fd203e
5 changed files with 6 additions and 6 deletions

View File

@ -78,7 +78,7 @@ class Account < ApplicationRecord
validates :username, format: { with: /\A#{USERNAME_RE}\z/i }, if: -> { !local? && will_save_change_to_username? }
# Local user validations
validates :username, format: { with: /\A[a-z0-9_]+\z/i }, length: { maximum: 30 }, if: -> { local? && will_save_change_to_username? }
validates :username, format: { with: /\A[a-z0-9_]+\z/i }, length: { maximum: 66 }, if: -> { local? && will_save_change_to_username? }
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: MAX_DISPLAY_NAME_LENGTH }, if: -> { local? && will_save_change_to_display_name? }
@ -388,7 +388,7 @@ class Account < ApplicationRecord
def string_limit
if account.local?
255
666
else
2047
end

View File

@ -18,7 +18,7 @@ class AccountIdentityProof < ApplicationRecord
belongs_to :account
validates :provider, inclusion: { in: ProofProvider::SUPPORTED_PROVIDERS }
validates :provider_username, format: { with: /\A[a-z0-9_]+\z/i }, length: { minimum: 2, maximum: 30 }
validates :provider_username, format: { with: /\A[a-z0-9_]+\z/i }, length: { minimum: 2, maximum: 66 }
validates :provider_username, uniqueness: { scope: [:account_id, :provider] }
validates :token, format: { with: /\A[a-f0-9]+\z/ }, length: { maximum: 66 }

View File

@ -17,5 +17,5 @@ class AccountModerationNote < ApplicationRecord
scope :latest, -> { reorder('created_at DESC') }
validates :content, presence: true, length: { maximum: 500 }
validates :content, presence: true, length: { maximum: 6666 }
end

View File

@ -27,7 +27,7 @@ class Report < ApplicationRecord
scope :unresolved, -> { where(action_taken: false) }
scope :resolved, -> { where(action_taken: true) }
validates :comment, length: { maximum: 1000 }
validates :comment, length: { maximum: 6666 }
def local?
false # Force uri_for to use uri attribute

View File

@ -17,5 +17,5 @@ class ReportNote < ApplicationRecord
scope :latest, -> { reorder(created_at: :desc) }
validates :content, presence: true, length: { maximum: 500 }
validates :content, presence: true, length: { maximum: 6666 }
end