summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
diff options
context:
space:
mode:
authorWilliam George <code@williamgeorge.co.uk>2018-10-18 09:06:44 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-10-18 09:06:44 +0000
commit1b153d497b6948932b0de2f0088fe7192eb0994a (patch)
treea4f93a1c3a12314b54b2486d5b471c929d4e7003 /lib/api/helpers.rb
parentc5d8e7fcee6bb15376902e8f1336f1ed368b9da8 (diff)
downloadgitlab-ce-1b153d497b6948932b0de2f0088fe7192eb0994a.tar.gz
Make getting a user by the username case insensitive
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb8
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index a7ba8066233..60bf977f0e4 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -96,15 +96,9 @@ module API
LabelsFinder.new(current_user, search_params).execute
end
- # rubocop: disable CodeReuse/ActiveRecord
def find_user(id)
- if id =~ /^\d+$/
- User.find_by(id: id)
- else
- User.find_by(username: id)
- end
+ UserFinder.new(id).find_by_id_or_username
end
- # rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def find_project(id)