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
Boxiang Sun
gitlab-ce
Commits
0a1baaa8
Commit
0a1baaa8
authored
Oct 05, 2016
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidy up project list actions
parent
42cb6597
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
28 deletions
+24
-28
lib/api/projects.rb
lib/api/projects.rb
+24
-28
No files found.
lib/api/projects.rb
View file @
0a1baaa8
...
@@ -22,14 +22,12 @@ module API
...
@@ -22,14 +22,12 @@ module API
# Example Request:
# Example Request:
# GET /projects
# GET /projects
get
do
get
do
@projects
=
current_user
.
authorized_projects
projects
=
current_user
.
authorized_projects
@projects
=
filter_projects
(
@projects
)
projects
=
filter_projects
(
projects
)
@projects
=
paginate
@projects
projects
=
paginate
projects
if
params
[
:simple
]
entity
=
params
[
:simple
]
?
Entities
::
BasicProjectDetails
:
Entities
::
ProjectWithAccess
present
@projects
,
with:
Entities
::
BasicProjectDetails
,
user:
current_user
else
present
projects
,
with:
entity
,
user:
current_user
present
@projects
,
with:
Entities
::
ProjectWithAccess
,
user:
current_user
end
end
end
# Get a list of visible projects for authenticated user
# Get a list of visible projects for authenticated user
...
@@ -37,14 +35,12 @@ module API
...
@@ -37,14 +35,12 @@ module API
# Example Request:
# Example Request:
# GET /projects/visible
# GET /projects/visible
get
'/visible'
do
get
'/visible'
do
@projects
=
ProjectsFinder
.
new
.
execute
(
current_user
)
projects
=
ProjectsFinder
.
new
.
execute
(
current_user
)
@projects
=
filter_projects
(
@projects
)
projects
=
filter_projects
(
projects
)
@projects
=
paginate
@projects
projects
=
paginate
projects
if
params
[
:simple
]
entity
=
params
[
:simple
]
?
Entities
::
BasicProjectDetails
:
Entities
::
ProjectWithAccess
present
@projects
,
with:
Entities
::
BasicProjectDetails
,
user:
current_user
else
present
projects
,
with:
entity
,
user:
current_user
present
@projects
,
with:
Entities
::
ProjectWithAccess
,
user:
current_user
end
end
end
# Get an owned projects list for authenticated user
# Get an owned projects list for authenticated user
...
@@ -52,10 +48,10 @@ module API
...
@@ -52,10 +48,10 @@ module API
# Example Request:
# Example Request:
# GET /projects/owned
# GET /projects/owned
get
'/owned'
do
get
'/owned'
do
@
projects
=
current_user
.
owned_projects
projects
=
current_user
.
owned_projects
@projects
=
filter_projects
(
@
projects
)
projects
=
filter_projects
(
projects
)
@projects
=
paginate
@
projects
projects
=
paginate
projects
present
@
projects
,
with:
Entities
::
ProjectWithAccess
,
user:
current_user
present
projects
,
with:
Entities
::
ProjectWithAccess
,
user:
current_user
end
end
# Gets starred project for the authenticated user
# Gets starred project for the authenticated user
...
@@ -63,10 +59,10 @@ module API
...
@@ -63,10 +59,10 @@ module API
# Example Request:
# Example Request:
# GET /projects/starred
# GET /projects/starred
get
'/starred'
do
get
'/starred'
do
@
projects
=
current_user
.
viewable_starred_projects
projects
=
current_user
.
viewable_starred_projects
@projects
=
filter_projects
(
@
projects
)
projects
=
filter_projects
(
projects
)
@projects
=
paginate
@
projects
projects
=
paginate
projects
present
@
projects
,
with:
Entities
::
Project
,
user:
current_user
present
projects
,
with:
Entities
::
Project
,
user:
current_user
end
end
# Get all projects for admin user
# Get all projects for admin user
...
@@ -75,10 +71,10 @@ module API
...
@@ -75,10 +71,10 @@ module API
# GET /projects/all
# GET /projects/all
get
'/all'
do
get
'/all'
do
authenticated_as_admin!
authenticated_as_admin!
@
projects
=
Project
.
all
projects
=
Project
.
all
@projects
=
filter_projects
(
@
projects
)
projects
=
filter_projects
(
projects
)
@projects
=
paginate
@
projects
projects
=
paginate
projects
present
@
projects
,
with:
Entities
::
ProjectWithAccess
,
user:
current_user
present
projects
,
with:
Entities
::
ProjectWithAccess
,
user:
current_user
end
end
# Get a single project
# Get a single project
...
...
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