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
98043aee
Commit
98043aee
authored
May 22, 2017
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy `filter_projects` helper to V3
The helper will be modified in V4, so copy the original to V4 to keep the current behavior in V3.
parent
8039b9c3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
helpers.rb
lib/api/v3/helpers.rb
+27
-0
No files found.
lib/api/v3/helpers.rb
View file @
98043aee
...
...
@@ -14,6 +14,33 @@ module API
authorize!
access_level
,
merge_request
merge_request
end
# project helpers
def
filter_projects
(
projects
)
if
params
[
:membership
]
projects
=
projects
.
merge
(
current_user
.
authorized_projects
)
end
if
params
[
:owned
]
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
end
end
end
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