BigW Consortium Gitlab

Make API::Helpers find a project with only one query

Signed-off-by: 's avatarRémy Coutable <remy@rymai.me>
parent 7100b769
---
title: 'Make API::Helpers find a project with only one query'
merge_request: 7714
author:
......@@ -76,7 +76,12 @@ module API
end
def find_project(id)
project = Project.find_with_namespace(id) || Project.find_by(id: id)
project =
if id =~ /^\d+$/
Project.find_by(id: id)
else
Project.find_with_namespace(id)
end
if can?(current_user, :read_project, project)
project
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment