Merge remote-tracking branch 'parent/main' into upstream-20240109
This commit is contained in:
commit
d35fa72842
333 changed files with 4444 additions and 2541 deletions
|
@ -114,7 +114,7 @@ class Account < ApplicationRecord
|
|||
validates_with UniqueUsernameValidator, if: -> { will_save_change_to_username? }
|
||||
|
||||
# Remote user validations, also applies to internal actors
|
||||
validates :username, format: { with: USERNAME_ONLY_RE }, if: -> { (!local? || actor_type == 'Application') && will_save_change_to_username? }
|
||||
validates :username, format: { with: USERNAME_ONLY_RE }, if: -> { (remote? || actor_type == 'Application') && will_save_change_to_username? }
|
||||
|
||||
# Remote user validations
|
||||
validates :uri, presence: true, unless: :local?, on: :create
|
||||
|
@ -125,6 +125,7 @@ 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_with EmptyProfileFieldNamesValidator, if: -> { local? && will_save_change_to_fields? }
|
||||
with_options on: :create do
|
||||
validates :uri, absence: true, if: :local?
|
||||
validates :inbox_url, absence: true, if: :local?
|
||||
|
@ -192,6 +193,10 @@ class Account < ApplicationRecord
|
|||
domain.nil?
|
||||
end
|
||||
|
||||
def remote?
|
||||
domain.present?
|
||||
end
|
||||
|
||||
def moved?
|
||||
moved_to_account_id.present?
|
||||
end
|
||||
|
@ -339,7 +344,7 @@ class Account < ApplicationRecord
|
|||
|
||||
if attributes.is_a?(Hash)
|
||||
attributes.each_value do |attr|
|
||||
next if attr[:name].blank?
|
||||
next if attr[:name].blank? && attr[:value].blank?
|
||||
|
||||
previous = old_fields.find { |item| item['value'] == attr[:value] }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue