Commit 71d92460 authored by Dmytro Zaporozhets's avatar Dmytro Zaporozhets

Make scoped issues routing a default one

A default issue link will look like `group/project/-/issues/123`.
The old unscoped routing will be still served but the UI links will be
scoped ones.
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 796cd50d
---
title: Move issues routes under /-/ scope
merge_request: 24791
author:
type: changed
......@@ -279,6 +279,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
draw :issues
draw :merge_requests
# The wiki and repository routing contains wildcard characters so
......@@ -401,12 +402,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
# Unscoped route. It will be replaced with redirect to /-/issues/
# Issue https://gitlab.com/gitlab-org/gitlab/issues/118849
draw :issues
# To ensure an old unscoped routing is used for the UI we need to
# add prefix 'as' to the scope routing and place it below original routing.
# Issue https://gitlab.com/gitlab-org/gitlab/issues/118849
scope '-', as: 'scoped' do
scope as: 'deprecated' do
draw :issues
end
......
......@@ -12,7 +12,8 @@
= render_ce 'projects/issues/discussion'
#designs-tab.tab-pane{ role: 'tabpanel', 'aria-labelledby': 'designs', data: { qa_selector: 'designs_tab_content'} }
- if @project.design_management_enabled?
#js-design-management{ data: { project_path: @project.full_path, issue_iid: @issue.iid, issue_path: project_issue_path(@project, @issue) } }
- deprecated_route = current_page?(project_deprecated_issue_path(@project, @issue)) || current_page?(designs_project_deprecated_issue_path(@project, @issue))
#js-design-management{ data: { project_path: @project.full_path, issue_iid: @issue.iid, issue_path: deprecated_route ? project_deprecated_issue_path(@project, @issue) : project_issue_path(@project, @issue) } }
- else
.mt-4
.row.empty-state
......@@ -26,4 +27,3 @@
- support_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: EE::CUSTOMER_SUPPORT_URL }
- link_end = '</a>'.html_safe
= s_("DesignManagement|To enable design management, you'll need to %{requirements_link_start}meet the requirements%{requirements_link_end}. If you need help, reach out to our %{support_link_start}support team%{support_link_end} for assistance.").html_safe % { requirements_link_start: requirements_link_start, requirements_link_end: link_end, support_link_start: support_link_start, support_link_end: link_end }
......@@ -81,7 +81,7 @@ describe EpicIssues::ListService do
weight: nil,
confidential: false,
reference: issue2.to_reference(full: true),
path: "/#{project.full_path}/issues/#{issue2.iid}",
path: "/#{project.full_path}/-/issues/#{issue2.iid}",
relation_path: "/groups/#{group.full_path}/-/epics/#{epic.iid}/issues/#{epic_issue2.id}",
epic_issue_id: epic_issue2.id,
due_date: nil,
......@@ -97,7 +97,7 @@ describe EpicIssues::ListService do
weight: 1,
confidential: false,
reference: issue1.to_reference(full: true),
path: "/#{project.full_path}/issues/#{issue1.iid}",
path: "/#{project.full_path}/-/issues/#{issue1.iid}",
relation_path: "/groups/#{group.full_path}/-/epics/#{epic.iid}/issues/#{epic_issue1.id}",
epic_issue_id: epic_issue1.id,
due_date: nil,
......@@ -113,7 +113,7 @@ describe EpicIssues::ListService do
weight: nil,
confidential: false,
reference: issue3.to_reference(full: true),
path: "/#{other_project.full_path}/issues/#{issue3.iid}",
path: "/#{other_project.full_path}/-/issues/#{issue3.iid}",
relation_path: "/groups/#{group.full_path}/-/epics/#{epic.iid}/issues/#{epic_issue3.id}",
epic_issue_id: epic_issue3.id,
due_date: nil,
......@@ -142,7 +142,7 @@ describe EpicIssues::ListService do
weight: nil,
confidential: false,
reference: issue2.to_reference(full: true),
path: "/#{project.full_path}/issues/#{issue2.iid}",
path: "/#{project.full_path}/-/issues/#{issue2.iid}",
relation_path: nil,
epic_issue_id: epic_issue2.id,
due_date: nil,
......@@ -158,7 +158,7 @@ describe EpicIssues::ListService do
weight: 1,
confidential: false,
reference: issue1.to_reference(full: true),
path: "/#{project.full_path}/issues/#{issue1.iid}",
path: "/#{project.full_path}/-/issues/#{issue1.iid}",
relation_path: nil,
epic_issue_id: epic_issue1.id,
due_date: nil,
......
......@@ -59,22 +59,22 @@ describe IssueLinks::ListService do
title: issue_b.title,
state: issue_b.state,
reference: issue_b.to_reference(project),
path: "/#{project.full_path}/issues/#{issue_b.iid}",
relation_path: "/#{project.full_path}/issues/#{issue.iid}/links/#{issue_link_a.id}"))
path: "/#{project.full_path}/-/issues/#{issue_b.iid}",
relation_path: "/#{project.full_path}/-/issues/#{issue.iid}/links/#{issue_link_a.id}"))
expect(subject).to include(include(id: issue_c.id,
title: issue_c.title,
state: issue_c.state,
reference: issue_c.to_reference(project),
path: "/#{project.full_path}/issues/#{issue_c.iid}",
relation_path: "/#{project.full_path}/issues/#{issue.iid}/links/#{issue_link_b.id}"))
path: "/#{project.full_path}/-/issues/#{issue_c.iid}",
relation_path: "/#{project.full_path}/-/issues/#{issue.iid}/links/#{issue_link_b.id}"))
expect(subject).to include(include(id: issue_d.id,
title: issue_d.title,
state: issue_d.state,
reference: issue_d.to_reference(project),
path: "/#{project.full_path}/issues/#{issue_d.iid}",
relation_path: "/#{project.full_path}/issues/#{issue.iid}/links/#{issue_link_c.id}"))
path: "/#{project.full_path}/-/issues/#{issue_d.iid}",
relation_path: "/#{project.full_path}/-/issues/#{issue.iid}/links/#{issue_link_c.id}"))
end
end
......@@ -188,7 +188,7 @@ describe IssueLinks::ListService do
it 'returns related issue destroy relation path' do
expect(subject.first[:relation_path])
.to eq("/#{project.full_path}/issues/#{issue.iid}/links/#{issue_link.id}")
.to eq("/#{project.full_path}/-/issues/#{issue.iid}/links/#{issue_link.id}")
end
end
end
......
......@@ -64,7 +64,7 @@ describe AwardEmojiHelper do
it 'returns correct url' do
@project = issue.project
expected_url = "/#{@project.namespace.path}/#{@project.path}/issues/#{issue.iid}/toggle_award_emoji"
expected_url = "/#{@project.namespace.path}/#{@project.path}/-/issues/#{issue.iid}/toggle_award_emoji"
expect(subject).to eq(expected_url)
end
......
......@@ -11,7 +11,7 @@ describe BoardsHelper do
@project = project
@board = create(:board, project: @project)
expect(build_issue_link_base).to eq("/#{@project.namespace.path}/#{@project.path}/issues")
expect(build_issue_link_base).to eq("/#{@project.namespace.path}/#{@project.path}/-/issues")
end
end
......
......@@ -110,7 +110,7 @@ describe EventsHelper do
it 'returns a project issue url' do
event.target = create(:note_on_issue, note: 'nice work')
expect(subject).to eq("#{project_base_url}/issues/#{event.note_target.iid}#note_#{event.target.id}")
expect(subject).to eq("#{project_base_url}/-/issues/#{event.note_target.iid}#note_#{event.target.id}")
end
it 'returns a merge request url' do
......
......@@ -183,8 +183,8 @@ describe IssuablesHelper do
@project = issue.project
expected_data = {
endpoint: "/#{@project.full_path}/issues/#{issue.iid}",
updateEndpoint: "/#{@project.full_path}/issues/#{issue.iid}.json",
endpoint: "/#{@project.full_path}/-/issues/#{issue.iid}",
updateEndpoint: "/#{@project.full_path}/-/issues/#{issue.iid}.json",
canUpdate: true,
canDestroy: true,
issuableRef: "##{issue.iid}",
......
......@@ -200,7 +200,7 @@ describe IssuesHelper do
shared_examples 'successfully displays link to issue and with css class' do |action|
it 'returns link' do
link = "<a class=\"#{css_class}\" href=\"/#{new_issue.project.full_path}/issues/#{new_issue.iid}\">(#{action})</a>"
link = "<a class=\"#{css_class}\" href=\"/#{new_issue.project.full_path}/-/issues/#{new_issue.iid}\">(#{action})</a>"
expect(helper.issue_closed_link(issue, user, css_class: css_class)).to match(link)
end
......
......@@ -56,7 +56,7 @@ describe LabelsHelper do
context 'without subject' do
it "uses the label's project" do
expect(link_to_label(label_presenter)).to match %r{<a.*href="/#{label.project.full_path}/issues\?label_name%5B%5D=#{label.name}".*>.*</a>}m
expect(link_to_label(label_presenter)).to match %r{<a.*href="/#{label.project.full_path}/-/issues\?label_name%5B%5D=#{label.name}".*>.*</a>}m
end
end
......@@ -65,7 +65,7 @@ describe LabelsHelper do
let(:subject) { build(:project, namespace: namespace, name: 'bar3') }
it 'links to project issues page' do
expect(link_to_label(label_presenter)).to match %r{<a.*href="/foo3/bar3/issues\?label_name%5B%5D=#{label.name}".*>.*</a>}m
expect(link_to_label(label_presenter)).to match %r{<a.*href="/foo3/bar3/-/issues\?label_name%5B%5D=#{label.name}".*>.*</a>}m
end
end
......@@ -78,15 +78,7 @@ describe LabelsHelper do
end
context 'with a type argument' do
['issue', :issue].each do |type|
context "set to #{type}" do
it 'links to correct page' do
expect(link_to_label(label_presenter, type: type)).to match %r{<a.*href="/#{label.project.full_path}/#{type.to_s.pluralize}\?label_name%5B%5D=#{label.name}".*>.*</a>}m
end
end
end
['merge_request', :merge_request].each do |type|
['issue', :issue, 'merge_request', :merge_request].each do |type|
context "set to #{type}" do
it 'links to correct page' do
expect(link_to_label(label_presenter, type: type)).to match %r{<a.*href="/#{label.project.full_path}/-/#{type.to_s.pluralize}\?label_name%5B%5D=#{label.name}".*>.*</a>}m
......
......@@ -272,7 +272,7 @@ describe NotesHelper do
let(:note) { create(:note_on_issue, noteable: issue, project: project) }
it 'returns the noteable url with an anchor to the note' do
expect(noteable_note_url(note)).to match("/#{project.namespace.path}/#{project.path}/issues/#{issue.iid}##{dom_id(note)}")
expect(noteable_note_url(note)).to match("/#{project.namespace.path}/#{project.path}/-/issues/#{issue.iid}##{dom_id(note)}")
end
end
......
......@@ -64,7 +64,7 @@ export default {
resolve_path:
'/gitlab-org/gitlab-test/-/merge_requests/20/discussions/6b232e05bea388c6b043ccc243ba505faac04ea8/resolve',
resolve_with_issue_path:
'/gitlab-org/gitlab-test/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
'/gitlab-org/gitlab-test/-/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
},
{
id: '1753',
......@@ -117,7 +117,7 @@ export default {
resolve_path:
'/gitlab-org/gitlab-test/-/merge_requests/20/discussions/6b232e05bea388c6b043ccc243ba505faac04ea8/resolve',
resolve_with_issue_path:
'/gitlab-org/gitlab-test/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
'/gitlab-org/gitlab-test/-/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
},
{
id: '1754',
......@@ -160,7 +160,7 @@ export default {
resolve_path:
'/gitlab-org/gitlab-test/-/merge_requests/20/discussions/6b232e05bea388c6b043ccc243ba505faac04ea8/resolve',
resolve_with_issue_path:
'/gitlab-org/gitlab-test/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
'/gitlab-org/gitlab-test/-/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
},
{
id: '1755',
......@@ -203,7 +203,7 @@ export default {
resolve_path:
'/gitlab-org/gitlab-test/-/merge_requests/20/discussions/6b232e05bea388c6b043ccc243ba505faac04ea8/resolve',
resolve_with_issue_path:
'/gitlab-org/gitlab-test/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
'/gitlab-org/gitlab-test/-/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
},
{
id: '1756',
......@@ -246,7 +246,7 @@ export default {
resolve_path:
'/gitlab-org/gitlab-test/-/merge_requests/20/discussions/6b232e05bea388c6b043ccc243ba505faac04ea8/resolve',
resolve_with_issue_path:
'/gitlab-org/gitlab-test/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
'/gitlab-org/gitlab-test/-/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
},
],
individual_note: false,
......@@ -255,7 +255,7 @@ export default {
resolve_path:
'/gitlab-org/gitlab-test/-/merge_requests/20/discussions/6b232e05bea388c6b043ccc243ba505faac04ea8/resolve',
resolve_with_issue_path:
'/gitlab-org/gitlab-test/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
'/gitlab-org/gitlab-test/-/issues/new?discussion_to_resolve=6b232e05bea388c6b043ccc243ba505faac04ea8&merge_request_to_resolve_discussions_of=20',
diff_file: {
submodule: false,
submodule_link: null,
......
......@@ -40,17 +40,19 @@ describe('Issuable output', () => {
const IssuableDescriptionComponent = Vue.extend(issuableApp);
mock = new MockAdapter(axios);
mock.onGet('/gitlab-org/gitlab-shell/issues/9/realtime_changes/realtime_changes').reply(() => {
const res = Promise.resolve([200, REALTIME_REQUEST_STACK[realtimeRequestCount]]);
realtimeRequestCount += 1;
return res;
});
mock
.onGet('/gitlab-org/gitlab-shell/-/issues/9/realtime_changes/realtime_changes')
.reply(() => {
const res = Promise.resolve([200, REALTIME_REQUEST_STACK[realtimeRequestCount]]);
realtimeRequestCount += 1;
return res;
});
vm = new IssuableDescriptionComponent({
propsData: {
canUpdate: true,
canDestroy: true,
endpoint: '/gitlab-org/gitlab-shell/issues/9/realtime_changes',
endpoint: '/gitlab-org/gitlab-shell/-/issues/9/realtime_changes',
updateEndpoint: gl.TEST_HOST,
issuableRef: '#1',
initialTitleHtml: '',
......
......@@ -216,7 +216,7 @@ export default {
remove_wip_path: '/root/acets-app/-/merge_requests/22/remove_wip',
cancel_auto_merge_path: '/root/acets-app/-/merge_requests/22/cancel_auto_merge',
create_issue_to_resolve_discussions_path:
'/root/acets-app/issues/new?merge_request_to_resolve_discussions_of=22',
'/root/acets-app/-/issues/new?merge_request_to_resolve_discussions_of=22',
merge_path: '/root/acets-app/-/merge_requests/22/merge',
cherry_pick_in_fork_path:
'/root/acets-app/forks?continue%5Bnotice%5D=You%27re+not+allowed+to+make+changes+to+this+project+directly.+A+fork+of+this+project+has+been+created+that+you+can+make+changes+in%2C+so+you+can+submit+a+merge+request.+Try+to+revert+this+commit+again.&continue%5Bnotice_now%5D=You%27re+not+allowed+to+make+changes+to+this+project+directly.+A+fork+of+this+project+is+being+created+that+you+can+make+changes+in%2C+so+you+can+submit+a+merge+request.&continue%5Bto%5D=%2Froot%2Facets-app%2Fmerge_requests%2F22&namespace_key=1',
......
......@@ -20,7 +20,7 @@ describe Gitlab::UrlBuilder do
url = described_class.build(issue)
expect(url).to eq "#{Settings.gitlab['url']}/#{issue.project.full_path}/issues/#{issue.iid}"
expect(url).to eq "#{Settings.gitlab['url']}/#{issue.project.full_path}/-/issues/#{issue.iid}"
end
end
......@@ -107,7 +107,7 @@ describe Gitlab::UrlBuilder do
url = described_class.build(note)
expect(url).to eq "#{Settings.gitlab['url']}/#{issue.project.full_path}/issues/#{issue.iid}#note_#{note.id}"
expect(url).to eq "#{Settings.gitlab['url']}/#{issue.project.full_path}/-/issues/#{issue.iid}#note_#{note.id}"
end
end
......
......@@ -33,9 +33,9 @@ describe GitlabIssueTrackerService do
end
it 'gives the correct path' do
expect(service.project_url).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.full_path}/issues")
expect(service.new_issue_url).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.full_path}/issues/new")
expect(service.issue_url(432)).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.full_path}/issues/432")
expect(service.project_url).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.full_path}/-/issues")
expect(service.new_issue_url).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.full_path}/-/issues/new")
expect(service.issue_url(432)).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.full_path}/-/issues/432")
end
end
......@@ -45,9 +45,9 @@ describe GitlabIssueTrackerService do
end
it 'gives the correct path' do
expect(service.issue_tracker_path).to eq("/gitlab/root/#{project.full_path}/issues")
expect(service.new_issue_path).to eq("/gitlab/root/#{project.full_path}/issues/new")
expect(service.issue_path(432)).to eq("/gitlab/root/#{project.full_path}/issues/432")
expect(service.issue_tracker_path).to eq("/gitlab/root/#{project.full_path}/-/issues")
expect(service.new_issue_path).to eq("/gitlab/root/#{project.full_path}/-/issues/new")
expect(service.issue_path(432)).to eq("/gitlab/root/#{project.full_path}/-/issues/432")
end
end
end
......
......@@ -17,7 +17,7 @@ describe IssuePresenter do
describe '#web_url' do
it 'returns correct path' do
expect(presenter.web_url).to eq("http://localhost/#{group.name}/#{project.name}/issues/#{issue.iid}")
expect(presenter.web_url).to eq("http://localhost/#{group.name}/#{project.name}/-/issues/#{issue.iid}")
end
end
......@@ -37,7 +37,7 @@ describe IssuePresenter do
describe '#issue_path' do
it 'returns correct path' do
expect(presenter.issue_path).to eq("/#{group.name}/#{project.name}/issues/#{issue.iid}")
expect(presenter.issue_path).to eq("/#{group.name}/#{project.name}/-/issues/#{issue.iid}")
end
end
end
......@@ -128,11 +128,11 @@ describe MergeRequestPresenter do
subject { described_class.new(resource, current_user: user).closing_issues_links }
it 'presents closing issues links' do
is_expected.to match("#{project.full_path}/issues/#{issue_a.iid}")
is_expected.to match("#{project.full_path}/-/issues/#{issue_a.iid}")
end
it 'does not present related issues links' do
is_expected.not_to match("#{project.full_path}/issues/#{issue_b.iid}")
is_expected.not_to match("#{project.full_path}/-/issues/#{issue_b.iid}")
end
it 'appends status when closing issue is already closed' do
......@@ -148,11 +148,11 @@ describe MergeRequestPresenter do
end
it 'presents related issues links' do
is_expected.to match("#{project.full_path}/issues/#{issue_b.iid}")
is_expected.to match("#{project.full_path}/-/issues/#{issue_b.iid}")
end
it 'does not present closing issues links' do
is_expected.not_to match("#{project.full_path}/issues/#{issue_a.iid}")
is_expected.not_to match("#{project.full_path}/-/issues/#{issue_a.iid}")
end
it 'appends status when mentioned issue is already closed' do
......@@ -275,7 +275,7 @@ describe MergeRequestPresenter do
project.add_maintainer(user)
is_expected
.to eq("/#{resource.project.full_path}/issues/new?merge_request_to_resolve_discussions_of=#{resource.iid}")
.to eq("/#{resource.project.full_path}/-/issues/new?merge_request_to_resolve_discussions_of=#{resource.iid}")
end
end
......
......@@ -78,7 +78,7 @@ describe API::Releases do
issue_uri = URI.parse(links['issues_url'])
expect(mr_uri.path).to eq("#{path_base}/-/merge_requests")
expect(issue_uri.path).to eq("#{path_base}/issues")
expect(issue_uri.path).to eq("#{path_base}/-/issues")
expect(mr_uri.query).to eq(expected_query)
expect(issue_uri.query).to eq(expected_query)
end
......
......@@ -27,7 +27,7 @@ describe ErrorTracking::IssueDetailsService do
create(:sentry_issue, issue: gitlab_issue, sentry_issue_identifier: detailed_error.id)
expect(result[:issue].gitlab_issue).to include(
"http", "/#{project.full_path}/issues/#{gitlab_issue.iid}"
"http", "/#{project.full_path}/-/issues/#{gitlab_issue.iid}"
)
end
......
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