Merge commit 'd20a5c3ec9ed40a991245fe32d0acb6187dd48c4' into glitch-soc/merge-upstream
Conflicts: - `yarn.lock`: Not a real conflict, just a line adjacent to a glitch-soc only dependency getting updated. Updated dependencies as upstream did.
This commit is contained in:
commit
c827a98f19
80 files changed
+543
-499
No files matched your search
@@ -6,10 +6,7 @@ class UniqueUsernameValidator < ActiveModel::Validator
|
||||
def validate(account)
|
||||
return if account.username.blank?
|
||||
|
||||
normalized_username = account.username.downcase
|
||||
normalized_domain = account.domain&.downcase
|
||||
|
||||
scope = Account.where(Account.arel_table[:username].lower.eq normalized_username).where(Account.arel_table[:domain].lower.eq normalized_domain)
|
||||
scope = Account.with_username(account.username).with_domain(account.domain)
|
||||
scope = scope.where.not(id: account.id) if account.persisted?
|
||||
|
||||
account.errors.add(:username, :taken) if scope.exists?
|
||||
|
||||
Reference in new issue
Block a user