summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/api.js.coffee2
-rw-r--r--lib/api/entities.rb8
-rw-r--r--lib/api/projects.rb17
3 files changed, 7 insertions, 20 deletions
diff --git a/app/assets/javascripts/api.js.coffee b/app/assets/javascripts/api.js.coffee
index 45059ae4042..8028e66f089 100644
--- a/app/assets/javascripts/api.js.coffee
+++ b/app/assets/javascripts/api.js.coffee
@@ -3,7 +3,7 @@
groupPath: "/api/:version/groups/:id.json"
namespacesPath: "/api/:version/namespaces.json"
groupProjectsPath: "/api/:version/groups/:id/projects.json"
- projectsPath: "/api/:version/projects/simple.json"
+ projectsPath: "/api/:version/projects.json?format=simple"
labelsPath: "/api/:version/projects/:id/labels"
licensePath: "/api/:version/licenses/:key"
gitignorePath: "/api/:version/gitignores/:key"
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 951cca248a1..0def1ed2823 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -90,12 +90,6 @@ module API
end
end
- class SimpleProject < Grape::Entity
- expose :id
- expose :name, :name_with_namespace
- expose :http_url_to_repo
- end
-
class ProjectMember < UserBasic
expose :access_level do |user, options|
options[:project].project_members.find_by(user_id: user.id).access_level
@@ -347,7 +341,7 @@ module API
end
end
- class SimpleProjectWithAccess < SimpleProject
+ class BasicProjectWithAccess < BasicProjectDetails
expose :permissions do
expose :project_access, using: Entities::ProjectAccess do |project, options|
project.project_members.find_by(user_id: options[:user].id)
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index c1e66b239aa..c46764c4897 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -25,18 +25,11 @@ module API
@projects = current_user.authorized_projects
@projects = filter_projects(@projects)
@projects = paginate @projects
- present @projects, with: Entities::ProjectWithAccess, user: current_user
- end
-
- # Get a simplified project list for authenticated user
- #
- # Example Request:
- # GET /projects/simple
- get '/simple' do
- @projects = current_user.authorized_projects
- @projects = filter_projects(@projects)
- @projects = paginate @projects
- present @projects, with: Entities::SimpleProjectWithAccess, user: current_user
+ if params["format"]
+ present @projects, with: Entities::BasicProjectWithAccess, user: current_user
+ else
+ present @projects, with: Entities::ProjectWithAccess, user: current_user
+ end
end
# Get an owned projects list for authenticated user