Merge branch 'master' into glitch-soc/merge-upstream
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# See also: USERNAME_RE in the Account class
|
||||
|
||||
class UniqueUsernameValidator < ActiveModel::Validator
|
||||
def validate(account)
|
||||
return if account.username.nil?
|
||||
|
||||
normalized_username = account.username.downcase.delete('.')
|
||||
normalized_username = account.username.downcase
|
||||
|
||||
scope = Account.where(domain: nil).where('lower(username) = ?', normalized_username)
|
||||
scope = scope.where.not(id: account.id) if account.persisted?
|
||||
|
Reference in New Issue
Block a user