summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/api.js12
-rw-r--r--spec/javascripts/api_spec.js21
2 files changed, 2 insertions, 31 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js
index 501cc43d552..7b00e1fa780 100644
--- a/app/assets/javascripts/api.js
+++ b/app/assets/javascripts/api.js
@@ -6,8 +6,7 @@ const Api = {
namespacesPath: '/api/:version/namespaces.json',
groupProjectsPath: '/api/:version/groups/:id/projects.json',
projectsPath: '/api/:version/projects.json',
- projectLabelsPath: '/:namespace_path/:project_path/labels',
- groupLabelsPath: '/groups/:namespace_path/labels',
+ labelsPath: '/:namespace_path/:project_path/labels',
licensePath: '/api/:version/templates/licenses/:key',
gitignorePath: '/api/:version/templates/gitignores/:key',
gitlabCiYmlPath: '/api/:version/templates/gitlab_ci_ymls/:key',
@@ -75,14 +74,7 @@ const Api = {
},
newLabel(namespacePath, projectPath, data, callback) {
- let url;
- if (projectPath) {
- url = Api.buildUrl(Api.projectLabelsPath)
- .replace(':namespace_path', namespacePath)
- .replace(':project_path', projectPath);
- } else {
- url = Api.buildUrl(Api.groupLabelsPath).replace(':namespace_path', namespacePath);
- }
+ const url = Api.buildUrl(Api.labelsPath);
return $.ajax({
url,
type: 'POST',
diff --git a/spec/javascripts/api_spec.js b/spec/javascripts/api_spec.js
index 643b22a00f8..2aa4fb1f6c6 100644
--- a/spec/javascripts/api_spec.js
+++ b/spec/javascripts/api_spec.js
@@ -167,27 +167,6 @@ describe('Api', () => {
done();
});
});
-
- it('creates a new group label', (done) => {
- const namespace = 'some namespace';
- const labelData = { some: 'data' };
- const expectedUrl = `${dummyUrlRoot}/${namespace}/labels`;
- const expectedData = {
- label: labelData,
- };
- spyOn(jQuery, 'ajax').and.callFake((request) => {
- expect(request.url).toEqual(expectedUrl);
- expect(request.dataType).toEqual('json');
- expect(request.type).toEqual('POST');
- expect(request.data).toEqual(expectedData);
- return sendDummyResponse();
- });
-
- Api.newLabel(namespace, null, labelData, (response) => {
- expect(response).toBe(dummyResponse);
- done();
- });
- });
});
describe('groupProjects', () => {