From 72c16967e61afaa59516f8fe94554af5d6eb2c87 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 13 Apr 2017 11:32:20 +0800 Subject: [PATCH] FIX: Check for reserved usernames before hitting DB. --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 8b1d540a1e1..6ce645d43d3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -162,7 +162,7 @@ class User < ActiveRecord::Base def self.username_available?(username) lower = username.downcase - !User.where(username_lower: lower).exists? && !reserved_username?(lower) + !reserved_username?(lower) && !User.where(username_lower: lower).exists? end def self.reserved_username?(username)