Raise various string limits.
parent
1fe28ca9d6
commit
9753fd203e
|
@ -78,7 +78,7 @@ class Account < ApplicationRecord
|
||||||
validates :username, format: { with: /\A#{USERNAME_RE}\z/i }, if: -> { !local? && will_save_change_to_username? }
|
validates :username, format: { with: /\A#{USERNAME_RE}\z/i }, if: -> { !local? && will_save_change_to_username? }
|
||||||
|
|
||||||
# Local user validations
|
# 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 UniqueUsernameValidator, if: -> { local? && will_save_change_to_username? }
|
||||||
validates_with UnreservedUsernameValidator, 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? }
|
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
|
def string_limit
|
||||||
if account.local?
|
if account.local?
|
||||||
255
|
666
|
||||||
else
|
else
|
||||||
2047
|
2047
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,7 @@ class AccountIdentityProof < ApplicationRecord
|
||||||
belongs_to :account
|
belongs_to :account
|
||||||
|
|
||||||
validates :provider, inclusion: { in: ProofProvider::SUPPORTED_PROVIDERS }
|
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 :provider_username, uniqueness: { scope: [:account_id, :provider] }
|
||||||
validates :token, format: { with: /\A[a-f0-9]+\z/ }, length: { maximum: 66 }
|
validates :token, format: { with: /\A[a-f0-9]+\z/ }, length: { maximum: 66 }
|
||||||
|
|
||||||
|
|
|
@ -17,5 +17,5 @@ class AccountModerationNote < ApplicationRecord
|
||||||
|
|
||||||
scope :latest, -> { reorder('created_at DESC') }
|
scope :latest, -> { reorder('created_at DESC') }
|
||||||
|
|
||||||
validates :content, presence: true, length: { maximum: 500 }
|
validates :content, presence: true, length: { maximum: 6666 }
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,7 +27,7 @@ class Report < ApplicationRecord
|
||||||
scope :unresolved, -> { where(action_taken: false) }
|
scope :unresolved, -> { where(action_taken: false) }
|
||||||
scope :resolved, -> { where(action_taken: true) }
|
scope :resolved, -> { where(action_taken: true) }
|
||||||
|
|
||||||
validates :comment, length: { maximum: 1000 }
|
validates :comment, length: { maximum: 6666 }
|
||||||
|
|
||||||
def local?
|
def local?
|
||||||
false # Force uri_for to use uri attribute
|
false # Force uri_for to use uri attribute
|
||||||
|
|
|
@ -17,5 +17,5 @@ class ReportNote < ApplicationRecord
|
||||||
|
|
||||||
scope :latest, -> { reorder(created_at: :desc) }
|
scope :latest, -> { reorder(created_at: :desc) }
|
||||||
|
|
||||||
validates :content, presence: true, length: { maximum: 500 }
|
validates :content, presence: true, length: { maximum: 6666 }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue