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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
86e2b07a
Commit
86e2b07a
authored
Mar 27, 2017
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'labels-finder-optimize-project' into 'master'
Optimize labels finder query See merge request !10248
parents
7324d671
6e6da4bb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
app/finders/labels_finder.rb
app/finders/labels_finder.rb
+11
-2
changelogs/unreleased/labels-finder-optimize-project.yml
changelogs/unreleased/labels-finder-optimize-project.yml
+4
-0
No files found.
app/finders/labels_finder.rb
View file @
86e2b07a
...
@@ -20,9 +20,18 @@ class LabelsFinder < UnionFinder
...
@@ -20,9 +20,18 @@ class LabelsFinder < UnionFinder
if
project?
if
project?
if
project
if
project
label_ids
<<
project
.
group
.
labels
if
project
.
group
.
present?
if
project
.
group
.
present?
labels_table
=
Label
.
arel_table
label_ids
<<
Label
.
where
(
labels_table
[
:type
].
eq
(
'GroupLabel'
).
and
(
labels_table
[
:group_id
].
eq
(
project
.
group
.
id
)).
or
(
labels_table
[
:type
].
eq
(
'ProjectLabel'
).
and
(
labels_table
[
:project_id
].
eq
(
project
.
id
))
)
)
else
label_ids
<<
project
.
labels
label_ids
<<
project
.
labels
end
end
end
else
else
label_ids
<<
Label
.
where
(
group_id:
projects
.
group_ids
)
label_ids
<<
Label
.
where
(
group_id:
projects
.
group_ids
)
label_ids
<<
Label
.
where
(
project_id:
projects
.
select
(
:id
))
label_ids
<<
Label
.
where
(
project_id:
projects
.
select
(
:id
))
...
...
changelogs/unreleased/labels-finder-optimize-project.yml
0 → 100644
View file @
86e2b07a
---
title
:
Optimize labels finder query when searching for a project with a group
merge_request
:
author
:
mhasbini
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