mirror of
https://github.com/funamitech/mastodon
synced 2024-11-23 22:57:05 +09:00
Use with_options
for shared Account validation option value (#31827)
This commit is contained in:
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 :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 :uri, absence: true, if: :local?, on: :create
|
||||
validates :inbox_url, absence: true, if: :local?, on: :create
|
||||
validates :shared_inbox_url, absence: true, if: :local?, on: :create
|
||||
validates :followers_url, absence: true, if: :local?, on: :create
|
||||
with_options on: :create do
|
||||
validates :uri, absence: true, if: :local?
|
||||
validates :inbox_url, absence: true, if: :local?
|
||||
validates :shared_inbox_url, absence: true, if: :local?
|
||||
validates :followers_url, absence: true, if: :local?
|
||||
end
|
||||
|
||||
normalizes :username, with: ->(username) { username.squish }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user