diff options
author | Steve Fink <sfink@mozilla.com> | 2011-02-17 13:40:13 -0800 |
---|---|---|
committer | Steve Fink <sfink@mozilla.com> | 2011-02-17 13:40:13 -0800 |
commit | 0d8f850effd1a0d0460160d8bbe4dccb8f5f1462 (patch) | |
tree | a8c448336eaf94209aab4e6fe5f8449d424e7cf9 | |
parent | fc0710b2f7cfcf1a549f1451df529cbc8de8b5a1 (diff) | |
download | bugzilla-triage-0d8f850effd1a0d0460160d8bbe4dccb8f5f1462.tar.gz |
After submitting changes, redirect to a GET link to allow reloads, session restores, better titles in tab list
-rw-r--r-- | data/js/bug-page-mod.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/data/js/bug-page-mod.js b/data/js/bug-page-mod.js index 1e4341a..f800b0a 100644 --- a/data/js/bug-page-mod.js +++ b/data/js/bug-page-mod.js @@ -50,6 +50,19 @@ function tweakBugzilla(d) { if (/^Bug /.test(d.title)) d.title = d.title.slice(4); + // After POSTing, redirect with a GET back to the same bug + if (/\/(process_bug|attachment).cgi$/.test(d.location.href)) { + var bug = getBugId(d); + if (bug) { + d.body.innerHTML = "Changes submitted; reloading bug " + bug; + var url = d.location.href; + url = url.replace("process_bug.cgi", "show_bug.cgi"); + url = url.replace("attachment.cgi", "show_bug.cgi"); + url += "?id=" + bug; + d.location.href = url; + } + } + // Make the comment box bigger var commentBox = d.querySelector("#comment"); if (commentBox) @@ -430,6 +443,15 @@ function transformType(str, doc, old, new_) { return str; } +function getBugId(d) { + var classes = d.body.classList; + for (var i = 0; i < classes.length; i++) { + var m = /^bz_bug_(\d+)$/.exec(classes[i]); + return m[1]; + } + return undefined; +} + // new is a keyword, which makes this function uglier than I'd like function formatTransition(old, new_, type, doc, histDoc) { if (old.length) { |