Add small improvements to constrainers and specs

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets
2016-11-08 14:32:42 +02:00
parent 82e551bdac
commit 08d21fe899
4 changed files with 4 additions and 4 deletions

View File

@ -7,7 +7,7 @@ class GroupUrlConstrainer
id = extract_resource_path(request.path)
if id =~ Gitlab::Regex.namespace_regex
!!Group.find_by_path(id)
Group.find_by(path: id).present?
else
false
end

View File

@ -7,7 +7,7 @@ class UserUrlConstrainer
id = extract_resource_path(request.path)
if id =~ Gitlab::Regex.namespace_regex
!!User.find_by('lower(username) = ?', id.downcase)
User.find_by('lower(username) = ?', id.downcase).present?
else
false
end