diff options
-rw-r--r-- | bugzillaBugTriage.js | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js index ba2aaa7..2397445 100644 --- a/bugzillaBugTriage.js +++ b/bugzillaBugTriage.js @@ -640,6 +640,7 @@ function BZPage(doc) { this.setUpLoggingButtons(); } + this.bugNo = this.getBugNo(this.doc.location.toString()); this.reporter = this.getReporter(); this.product = this.getOptionValue("product"); this.component = this.getOptionValue("component"); @@ -955,6 +956,22 @@ BZPage.prototype.generateButtons = function() { } }; +BZPage.prototype.getBugNo = function(url) { + // FIXME Why not to parse URL? +// let bugNoTitle = this.doc.querySelector("#title > p").textContent.trim(); +// console.log("bugNoTitle = " + bugNoTitle); +// this.bugNo = this.getBugNo(this.doc.location.toString()); +// https://bugzilla.redhat.com/show_bug.cgi?id=583826 + let re = new RegExp(".*id=([0-9]+).*$"); + let bugNo = null; + let reResult = re.exec(url); + if (reResult[1]) { + bugNo = reResult[1]; + console.log("this.bugNo = " + bugNo); + } + return bugNo; +}; + /** * Get the current email of the reporter of the bug. * @@ -1408,9 +1425,6 @@ RHBugzillaPage = function(doc) { this.login = this.getLogin(); this.password = this.getPassword(); - let bugNoTitle = this.doc.querySelector("#title > p").textContent.trim(); - this.bugNo = new RegExp("[0-9]+").exec(bugNoTitle)[0]; - let ITbutton = this.doc.getElementById("cf_issuetracker"); this.its = ITbutton ? ITbutton.value.trim() : ""; @@ -2498,7 +2512,7 @@ RHBugzillaPage.prototype.parseBacktrace = function(ret) { RHBugzillaPage.prototype.addLogRecord = function() { let rec = {}; rec.date = new Date(); - rec.bugId = this.bugNo; + rec.url = this.doc.location.toString(); rec.title = this.title; let comment = jetpack.tabs.focused.contentWindow.prompt( "Enter comments for this comment").trim(); |