summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortiagonbotelho <tiagonbotelho@hotmail.com>2016-07-08 09:47:09 +0100
committertiagonbotelho <tiagonbotelho@hotmail.com>2016-07-12 16:36:42 +0100
commitf5d92d120edbd6bc730f10293a5847dd9b0e22fc (patch)
tree8989207a7c631738110701b255ba4720e46164ce
parent6715ea7dc8b92e54e728f155cc4edeb917585168 (diff)
downloadgitlab-ce-f5d92d120edbd6bc730f10293a5847dd9b0e22fc.tar.gz
changes the usage of simpleprojectdetails to already implemented basicprojectsdetails and changes the url to a more reader friendly format
-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