diff --git a/app/models/account.rb b/app/models/account.rb index d773d33441..4a7c752e7c 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -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 }