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
Tatuya Kamada
gitlab-ce
Commits
76db0dc1
Commit
76db0dc1
authored
Aug 12, 2016
by
Ahmad Sherif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass project IDs relation to ProjectsFinder instead of using a block
parent
d13c36f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
5 deletions
+3
-5
app/finders/projects_finder.rb
app/finders/projects_finder.rb
+2
-2
app/finders/todos_finder.rb
app/finders/todos_finder.rb
+1
-3
No files found.
app/finders/projects_finder.rb
View file @
76db0dc1
class
ProjectsFinder
<
UnionFinder
class
ProjectsFinder
<
UnionFinder
def
execute
(
current_user
=
nil
,
options
=
{},
&
block
)
def
execute
(
current_user
=
nil
,
project_ids_relation
=
nil
)
segments
=
all_projects
(
current_user
)
segments
=
all_projects
(
current_user
)
segments
.
map!
(
&
block
)
if
block
segments
.
map!
{
|
s
|
s
.
where
(
id:
project_ids_relation
)
}
if
project_ids_relation
find_union
(
segments
,
Project
)
find_union
(
segments
,
Project
)
end
end
...
...
app/finders/todos_finder.rb
View file @
76db0dc1
...
@@ -95,9 +95,7 @@ class TodosFinder
...
@@ -95,9 +95,7 @@ class TodosFinder
def
projects
(
items
)
def
projects
(
items
)
item_project_ids
=
items
.
reorder
(
nil
).
select
(
:project_id
)
item_project_ids
=
items
.
reorder
(
nil
).
select
(
:project_id
)
ProjectsFinder
.
new
.
execute
(
current_user
)
do
|
relation
|
ProjectsFinder
.
new
.
execute
(
current_user
,
item_project_ids
)
relation
.
where
(
id:
item_project_ids
)
end
end
end
def
type?
def
type?
...
...
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