Commit f12fe50f authored by Sean McGivern's avatar Sean McGivern

Merge branch 'js_should_user_right_api_version' into 'master'

The frontend should use the v3 API for now

Closes gitlab-ce#28863

See merge request !1331
parents 7eed947b f0a16fbd
......@@ -17,7 +17,8 @@
group_result = Api.groups(query.term, {}, function(groups) {
return groups;
});
project_result = Api.projects(query.term, 'id', function(projects) {
// Should be replaced with "Api.projects" when API v4 is frozen (9.1)
project_result = Api.allProjects(query.term, 'id', function(projects) {
return projects;
});
return $.when(project_result, group_result).done(function(projects, groups) {
......
......@@ -7,6 +7,7 @@
namespacesPath: "/api/:version/namespaces.json",
groupProjectsPath: "/api/:version/groups/:id/projects.json",
projectsPath: "/api/:version/projects.json?simple=true",
allProjectsPath: "/api/:version/projects/all.json?simple=true", // Deprecated. Valid for API v3 only.
labelsPath: "/:namespace_path/:project_path/labels",
licensePath: "/api/:version/templates/licenses/:key",
gitignorePath: "/api/:version/templates/gitignores/:key",
......@@ -67,6 +68,24 @@
return callback(projects);
});
},
// Deprecated and should be deleted for 9.1
// Also the 'Api.allProjectsPath' should be deleted as well.
// Basically, the whole commit that adds this comment should be reverted when API v4 is frozen (9.1)
// Details here: https://gitlab.com/gitlab-org/gitlab-ce/issues/28853#note_24410695
allProjects: function(query, order, callback) {
var url = Api.buildUrl(Api.allProjectsPath);
return $.ajax({
url: url,
data: {
search: query,
order_by: order,
per_page: 20
},
dataType: "json"
}).done(function(projects) {
return callback(projects);
});
},
newLabel: function(namespace_path, project_path, data, callback) {
var url = Api.buildUrl(Api.labelsPath)
.replace(':namespace_path', namespace_path)
......
module Gitlab
module GonHelper
def add_gon_variables
gon.api_version = API::API.version
gon.api_version = 'v3' # v4 Is not officially released yet, therefore can't be considered as "frozen"
gon.default_avatar_url = URI.join(Gitlab.config.gitlab.url, ActionController::Base.helpers.image_path('no_avatar.png')).to_s
gon.max_file_size = current_application_settings.max_attachment_size
gon.relative_url_root = Gitlab.config.gitlab.relative_url_root
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment