From 08d21fe89927fa9ebd3695fde047a17d27893dbf Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 8 Nov 2016 14:32:42 +0200 Subject: Add small improvements to constrainers and specs Signed-off-by: Dmitriy Zaporozhets --- lib/constraints/group_url_constrainer.rb | 2 +- lib/constraints/user_url_constrainer.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/constraints') diff --git a/lib/constraints/group_url_constrainer.rb b/lib/constraints/group_url_constrainer.rb index 2bf973a73da..2af6e1a11c8 100644 --- a/lib/constraints/group_url_constrainer.rb +++ b/lib/constraints/group_url_constrainer.rb @@ -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 diff --git a/lib/constraints/user_url_constrainer.rb b/lib/constraints/user_url_constrainer.rb index 9583cace022..4d722ad5af2 100644 --- a/lib/constraints/user_url_constrainer.rb +++ b/lib/constraints/user_url_constrainer.rb @@ -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 -- cgit v1.2.3