diff options
Diffstat (limited to 'extensions')
4 files changed, 14 insertions, 9 deletions
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 f1896dccc..d7a4cc2a5 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 @@ <link rel="shortcut icon" href="extensions/BMO/web/images/favicon.ico"> [% IF bug %] -<link id="shorturl" rev="canonical" href="https://bugzil.la/[% bug.bug_id FILTER uri %]"> +<link id="shorturl" rel="canonical" href="[% Bugzilla.localconfig.canonical_urlbase FILTER none %]bug/[% bug.bug_id FILTER uri %]"> [% 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 38b6b572f..a21e9c268 100644 --- a/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl @@ -94,6 +94,7 @@ [%# 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 bf5c300e1..9d2701e51 100644 --- a/extensions/BugModal/web/bug_modal.js +++ b/extensions/BugModal/web/bug_modal.js @@ -1344,15 +1344,19 @@ function confirmUnsafeURL(url) { // fix url after bug creation/update if (history && history.replaceState) { - var href = document.location.href; - if (!href.match(/show_bug\.cgi/)) { - history.replaceState(null, BUGZILLA.bug_title, 'show_bug.cgi?id=' + BUGZILLA.bug_id); + 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); 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 51c388d42..247e44ea9 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 %] <meta property="og:type" content="website"> <meta property="og:title" content="[% title FILTER none %]"> -<meta property="og:url" content="[% Bugzilla.cgi.self_url FILTER html %]"> +<meta property="og:url" content="[% Bugzilla.cgi.url FILTER html %]"> [% IF bug %] <meta property="og:description" content="[% bug.bug_status FILTER html %] ([% bug.assigned_to.login FILTER email FILTER html %]) in [% bug.product FILTER html %] - [% bug.component FILTER html %]. Last updated [% bug.delta_ts FILTER time('%Y-%m-%d') %]."> |