diff options
-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) { |