0
0
Fork 0

Add Account#remote? query method (#33508)

This commit is contained in:
Matt Jankowski 2025-01-08 09:28:08 -05:00 committed by GitHub
parent 15669fcf75
commit f22a2aab40
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 10 deletions

View file

@ -107,7 +107,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
@ -186,6 +186,10 @@ class Account < ApplicationRecord
domain.nil?
end
def remote?
domain.present?
end
def moved?
moved_to_account_id.present?
end