mirror of https://github.com/tootsuite/mastodon
Use `with_options` for shared Account validation option value (#31827)
parent
9ea710e543
commit
5b995143f1
|
@ -111,10 +111,12 @@ class Account < ApplicationRecord
|
||||||
validates :display_name, length: { maximum: DISPLAY_NAME_LENGTH_LIMIT }, if: -> { local? && will_save_change_to_display_name? }
|
validates :display_name, length: { maximum: DISPLAY_NAME_LENGTH_LIMIT }, if: -> { local? && will_save_change_to_display_name? }
|
||||||
validates :note, note_length: { maximum: NOTE_LENGTH_LIMIT }, if: -> { local? && will_save_change_to_note? }
|
validates :note, note_length: { maximum: NOTE_LENGTH_LIMIT }, if: -> { local? && will_save_change_to_note? }
|
||||||
validates :fields, length: { maximum: DEFAULT_FIELDS_SIZE }, if: -> { local? && will_save_change_to_fields? }
|
validates :fields, length: { maximum: DEFAULT_FIELDS_SIZE }, if: -> { local? && will_save_change_to_fields? }
|
||||||
validates :uri, absence: true, if: :local?, on: :create
|
with_options on: :create do
|
||||||
validates :inbox_url, absence: true, if: :local?, on: :create
|
validates :uri, absence: true, if: :local?
|
||||||
validates :shared_inbox_url, absence: true, if: :local?, on: :create
|
validates :inbox_url, absence: true, if: :local?
|
||||||
validates :followers_url, absence: true, if: :local?, on: :create
|
validates :shared_inbox_url, absence: true, if: :local?
|
||||||
|
validates :followers_url, absence: true, if: :local?
|
||||||
|
end
|
||||||
|
|
||||||
normalizes :username, with: ->(username) { username.squish }
|
normalizes :username, with: ->(username) { username.squish }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue