aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-05-21 17:02:27 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-05-21 17:02:27 +0200
commitd6776e719324d1a883a99ff9fb631c838a682ca2 (patch)
tree2ac8aead6df7b97cc5104df46e74fb3de763912e
parentb3c7cd4633a734c17d6035aee8e32a1491106f14 (diff)
downloadbugzilla-triage-d6776e719324d1a883a99ff9fb631c838a682ca2.tar.gz
Bug no. should be parsed from the URL of the page.
-rw-r--r--bugzillaBugTriage.js22
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();