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
cf14482a
Commit
cf14482a
authored
Sep 20, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LabelsFinder inherits from UnionFinder
parent
476c26de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
app/finders/labels_finder.rb
app/finders/labels_finder.rb
+4
-9
No files found.
app/finders/labels_finder.rb
View file @
cf14482a
class
LabelsFinder
class
LabelsFinder
<
UnionFinder
def
initialize
(
current_user
,
params
=
{})
def
initialize
(
current_user
,
params
=
{})
@current_user
=
current_user
@current_user
=
current_user
@params
=
params
@params
=
params
end
end
def
execute
def
execute
items
=
init_collection
items
=
find_union
(
label_ids
,
Label
)
items
=
with_title
(
items
)
items
=
with_title
(
items
)
sort
(
items
)
sort
(
items
)
end
end
...
@@ -14,15 +14,10 @@ class LabelsFinder
...
@@ -14,15 +14,10 @@ class LabelsFinder
attr_reader
:current_user
,
:params
attr_reader
:current_user
,
:params
def
init_collection
def
label_ids
label_ids
=
[]
label_ids
=
[]
label_ids
<<
Label
.
where
(
group_id:
projects
.
where
.
not
(
group:
nil
).
select
(
:namespace_id
)).
select
(
:id
)
label_ids
<<
Label
.
where
(
group_id:
projects
.
where
.
not
(
group:
nil
).
select
(
:namespace_id
)).
select
(
:id
)
label_ids
<<
Label
.
where
(
project_id:
projects
).
select
(
:id
)
label_ids
<<
Label
.
where
(
project_id:
projects
.
select
(
:id
)).
select
(
:id
)
union
=
Gitlab
::
SQL
::
Union
.
new
(
label_ids
)
Label
.
where
(
"labels.id IN (
#{
union
.
to_sql
}
)"
)
.
reorder
(
title: :asc
)
end
end
def
with_title
(
items
)
def
with_title
(
items
)
...
...
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