diff options
-rw-r--r-- | app/assets/javascripts/api.js.coffee | 2 | ||||
-rw-r--r-- | app/assets/javascripts/gl_dropdown.js.coffee | 1 | ||||
-rw-r--r-- | lib/api/projects.rb | 2 | ||||
-rw-r--r-- | spec/javascripts/project_title_spec.js.coffee | 2 | ||||
-rw-r--r-- | spec/requests/api/projects_spec.rb | 10 |
5 files changed, 13 insertions, 4 deletions
diff --git a/app/assets/javascripts/api.js.coffee b/app/assets/javascripts/api.js.coffee index 8028e66f089..89b0ac697ed 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.json?format=simple" + projectsPath: "/api/:version/projects.json?simple=true" labelsPath: "/api/:version/projects/:id/labels" licensePath: "/api/:version/licenses/:key" gitignorePath: "/api/:version/gitignores/:key" diff --git a/app/assets/javascripts/gl_dropdown.js.coffee b/app/assets/javascripts/gl_dropdown.js.coffee index 4743b484d22..1c65e833d47 100644 --- a/app/assets/javascripts/gl_dropdown.js.coffee +++ b/app/assets/javascripts/gl_dropdown.js.coffee @@ -401,7 +401,6 @@ class GitLabDropdown selected = true # Set URL - console.log(data) if @options.url? url = @options.url(data) else diff --git a/lib/api/projects.rb b/lib/api/projects.rb index c46764c4897..7aea553bdca 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -25,7 +25,7 @@ module API @projects = current_user.authorized_projects @projects = filter_projects(@projects) @projects = paginate @projects - if params["format"] + if params["simple"] present @projects, with: Entities::BasicProjectWithAccess, user: current_user else present @projects, with: Entities::ProjectWithAccess, user: current_user diff --git a/spec/javascripts/project_title_spec.js.coffee b/spec/javascripts/project_title_spec.js.coffee index e49dfbf1ba4..0244119fa0e 100644 --- a/spec/javascripts/project_title_spec.js.coffee +++ b/spec/javascripts/project_title_spec.js.coffee @@ -22,7 +22,7 @@ describe 'Project Title', -> @projects_data = fixture.load('projects.json')[0] spyOn(jQuery, 'ajax').and.callFake (req) => - expect(req.url).toBe('/api/v3/projects.json?format=simple') + expect(req.url).toBe('/api/v3/projects.json?simple=true') d = $.Deferred() d.resolve @projects_data d.promise() diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 8a52725a893..2a0b56c5052 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -81,6 +81,16 @@ describe API::API, api: true do expect(json_response.first.keys).not_to include('open_issues_count') end + context 'GET /projects?simple=true' do + let(:keys) { ["id", "http_url_to_repo", "web_url", "name", "name_with_namespace", "path", "path_with_namespace", "permissions"] } + it 'should return a simplified version of all the projects' do + get api('/projects?simple=true', user) + expect(response).to have_http_status(200) + expect(json_response).to be_an Array + expect(json_response.first.keys).to match_array keys + end + end + context 'and using search' do it 'should return searched project' do get api('/projects', user), { search: project.name } |