Use - as the prefix so we don't conflict with namespaces

The decision was made around:
https://gitlab.com/gitlab-org/gitlab-ce/issues/26407#note_30624641
This commit is contained in:
Lin Jen-Shin 2017-05-26 21:55:29 +08:00
parent 70eb0c6a88
commit c94db0c290
11 changed files with 13 additions and 26 deletions

View file

@ -181,7 +181,7 @@ constraints(ProjectUrlConstrainer.new) do
end
end
resources :jobs, only: [:index, :show], constraints: { id: /\d+/ } do
resources :jobs, path: '-/jobs', only: [:index, :show], constraints: { id: /\d+/ } do
collection do
post :cancel_all

View file

@ -1,14 +0,0 @@
class RenameProjectsNamedJobs < ActiveRecord::Migration
include Gitlab::Database::RenameReservedPathsMigration::V1
DOWNTIME = false
disable_ddl_transaction!
def up
rename_wildcard_paths('jobs')
end
def down
end
end

View file

@ -80,6 +80,7 @@ module Gitlab
# By rejecting `badges` the router can _count_ on the fact that `badges` will
# be preceded by the `namespace/project`.
PROJECT_WILDCARD_ROUTES = %w[
-
badges
blame
blob

View file

@ -177,7 +177,7 @@ describe Projects::EnvironmentsController do
expect(response).to have_http_status(200)
expect(json_response).to eq(
{ 'redirect_url' =>
"http://test.host/#{project.path_with_namespace}/jobs/#{action.id}" })
namespace_project_job_url(project.namespace, project, action) })
end
end
@ -191,7 +191,7 @@ describe Projects::EnvironmentsController do
expect(response).to have_http_status(200)
expect(json_response).to eq(
{ 'redirect_url' =>
"http://test.host/#{project.path_with_namespace}/environments/#{environment.id}" })
namespace_project_environment_url(project.namespace, project, environment) })
end
end
end

View file

@ -15,7 +15,7 @@ feature 'Browse artifact', :js, feature: true do
end
before do
visit browse_url.sub('jobs', 'builds')
visit browse_url.sub('/-/jobs', '/builds')
end
it "redirects to new URL" do

View file

@ -39,7 +39,7 @@ feature 'Download artifact', :js, feature: true do
context 'when visiting old URL' do
before do
visit download_url.sub('jobs', 'builds')
visit download_url.sub('/-/jobs', '/builds')
end
context 'via job id' do

View file

@ -67,7 +67,7 @@ feature 'Artifact file', :js, feature: true do
end
before do
visit file_url.sub('jobs', 'builds')
visit file_url.sub('/-/jobs', '/builds')
end
it "redirects to new URL" do

View file

@ -15,7 +15,7 @@ feature 'Raw artifact', :js, feature: true do
end
before do
visit raw_url.sub('jobs', 'builds')
visit raw_url.sub('/-/jobs', '/builds')
end
it "redirects to new URL" do

View file

@ -85,7 +85,7 @@ feature 'Jobs', :feature do
end
before do
visit jobs_url.sub('jobs', 'builds')
visit jobs_url.sub('/-/jobs', '/builds')
end
it "redirects to new URL" do
@ -203,7 +203,7 @@ feature 'Jobs', :feature do
end
before do
visit job_url.sub('jobs', 'builds')
visit job_url.sub('/-/jobs', '/builds')
end
it "redirects to new URL" do
@ -473,7 +473,7 @@ feature 'Jobs', :feature do
end
before do
visit raw_job_url.sub('jobs', 'builds')
visit raw_job_url.sub('/-/jobs', '/builds')
end
it "redirects to new URL" do

View file

@ -8,7 +8,7 @@ import '~/breakpoints';
import 'vendor/jquery.nicescroll';
describe('Build', () => {
const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/jobs/1`;
const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/-/jobs/1`;
preloadFixtures('builds/build-with-artifacts.html.raw');

View file

@ -356,7 +356,7 @@ import '~/lib/utils/common_utils';
describe('gl.utils.setCiStatusFavicon', () => {
it('should set page favicon to CI status favicon based on provided status', () => {
const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/jobs/1/status.json`;
const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/-/jobs/1/status.json`;
const FAVICON_PATH = '//icon_status_success';
const spySetFavicon = spyOn(gl.utils, 'setFavicon').and.stub();
const spyResetFavicon = spyOn(gl.utils, 'resetFavicon').and.stub();