Full username_available? method
ngsankha opened this issue · 1 comments
ngsankha commented
Finally get to synthesis of something like:
def self.username_available?(username, email = nil)
lower = username.downcase
return false if reserved_username?(lower)
return true if !User.exists?(username_lower: lower)
# staged users can use the same username since they will take over the account
email.present? && User.joins(:user_emails).exists?(staged: true, username_lower: lower, user_emails: { primary: true, email: email })
end
Blockers:
ngsankha commented
We are basically there. The tests in the Discourse app are underspecified - so the synthesizer gives some other program. Need to come up with a good test.