From de80a6c015fb0d63040a111288be26b2118684a4 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Tue, 26 Jun 2018 16:59:30 -0400 Subject: Revert "Bug 1468848 - Change presentation of show_bug.cgi urls to be /bug/ID or /bug/ALIAS." This reverts commit 404dc5496967203c5f99755340f43d712420446a. --- .../hook/global/header-additional_header.html.tmpl | 2 +- .../template/en/default/bug_modal/header.html.tmpl | 1 - extensions/BugModal/web/bug_modal.js | 18 +++++++----------- .../en/default/hook/global/header-start.html.tmpl | 2 +- 4 files changed, 9 insertions(+), 14 deletions(-) (limited to 'extensions') diff --git a/extensions/BMO/template/en/default/hook/global/header-additional_header.html.tmpl b/extensions/BMO/template/en/default/hook/global/header-additional_header.html.tmpl index d7a4cc2a5..f1896dccc 100644 --- a/extensions/BMO/template/en/default/hook/global/header-additional_header.html.tmpl +++ b/extensions/BMO/template/en/default/hook/global/header-additional_header.html.tmpl @@ -21,7 +21,7 @@ [% IF bug %] - + [% END %] [%# *** Bug List Navigation *** %] diff --git a/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl index c5ae78af3..b9a42caf3 100644 --- a/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl @@ -89,7 +89,6 @@ [%# expose useful data to js %] BUGZILLA.bug_id = [% bug.id FILTER none %]; BUGZILLA.bug_title = '[% unfiltered_title FILTER js %]'; - BUGZILLA.bug_alias = '[% bug.alias FILTER js %]'; BUGZILLA.user = { id: [% user.id FILTER none %], login: '[% user.login FILTER js %]', diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js index ef015d3f9..d232c172a 100644 --- a/extensions/BugModal/web/bug_modal.js +++ b/extensions/BugModal/web/bug_modal.js @@ -1435,19 +1435,15 @@ function show_new_changes_indicator() { // fix url after bug creation/update if (history && history.replaceState) { - let bug_id = BUGZILLA.bug_id; - let bug_alias = BUGZILLA.bug_alias; - let bug_slug = bug_alias || bug_id; - let url = new URL(document.location.href); - if (!url.pathname.match(/^bug\/[0-9]+/)) { - url.searchParams.delete("id"); - let new_url = url.search ? `/bug/${bug_slug}${url.search}` : `/bug/${bug_slug}`; - if (url.hash) { - new_url += url.hash; - } - history.replaceState(null, BUGZILLA.bug_title, new_url); + var href = document.location.href; + if (!href.match(/show_bug\.cgi/)) { + history.replaceState(null, BUGZILLA.bug_title, 'show_bug.cgi?id=' + BUGZILLA.bug_id); document.title = BUGZILLA.bug_title; } + if (href.match(/show_bug\.cgi\?.*list_id=/)) { + href = href.replace(/[\?&]+list_id=(\d+|cookie)/, ''); + history.replaceState(null, BUGZILLA.bug_title, href); + } } // ajax wrapper, to simplify error handling and auth diff --git a/extensions/OpenGraph/template/en/default/hook/global/header-start.html.tmpl b/extensions/OpenGraph/template/en/default/hook/global/header-start.html.tmpl index 247e44ea9..51c388d42 100644 --- a/extensions/OpenGraph/template/en/default/hook/global/header-start.html.tmpl +++ b/extensions/OpenGraph/template/en/default/hook/global/header-start.html.tmpl @@ -9,7 +9,7 @@ [% USE Bugzilla %] - + [% IF bug %] -- cgit v1.2.3-24-g4f1b