BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
a1deed62
Commit
a1deed62
authored
May 23, 2017
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ProjectFinder to filter the projects
Instead of trying to do the heavy lifting in the API itself, use the existing features of the ProjectFinder.
parent
07250508
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
13 deletions
+4
-13
helpers.rb
lib/api/helpers.rb
+0
-13
projects.rb
lib/api/projects.rb
+4
-0
No files found.
lib/api/helpers.rb
View file @
a1deed62
...
...
@@ -261,19 +261,6 @@ module API
projects
=
projects
.
merge
(
current_user
.
owned_projects
)
end
if
params
[
:starred
]
projects
=
projects
.
merge
(
current_user
.
starred_projects
)
end
if
params
[
:search
].
present?
projects
=
projects
.
search
(
params
[
:search
])
end
if
params
[
:visibility
].
present?
projects
=
projects
.
search_by_visibility
(
params
[
:visibility
])
end
projects
=
projects
.
where
(
archived:
params
[
:archived
])
projects
.
reorder
(
params
[
:order_by
]
=>
params
[
:sort
])
end
...
...
lib/api/projects.rb
View file @
a1deed62
...
...
@@ -70,6 +70,10 @@ module API
def
present_projects
(
options
=
{})
finder_params
=
{}
finder_params
[
:non_public
]
=
true
if
params
[
:membership
].
present?
finder_params
[
:starred
]
=
true
if
params
[
:starred
].
present?
finder_params
[
:visibility_level
]
=
Gitlab
::
VisibilityLevel
.
level_value
(
params
[
:visibility
])
if
params
[
:visibility
]
finder_params
[
:archived
]
=
params
[
:archived
]
finder_params
[
:search
]
=
params
[
:search
]
if
params
[
:search
]
projects
=
ProjectsFinder
.
new
(
current_user:
current_user
,
params:
finder_params
).
execute
projects
=
filter_projects
(
projects
)
...
...
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