Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4d2e7894
Commit
4d2e7894
authored
Nov 23, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make API::Helpers find a project with only one query
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
7100b769
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
changelogs/unreleased/22373-reduce-queries-in-api-helpers-find_project.yml
...ased/22373-reduce-queries-in-api-helpers-find_project.yml
+4
-0
lib/api/helpers.rb
lib/api/helpers.rb
+6
-1
No files found.
changelogs/unreleased/22373-reduce-queries-in-api-helpers-find_project.yml
0 → 100644
View file @
4d2e7894
---
title
:
'
Make
API::Helpers
find
a
project
with
only
one
query'
merge_request
:
7714
author
:
lib/api/helpers.rb
View file @
4d2e7894
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment