aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rhbzpage.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-07-25 22:29:24 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-07-25 22:32:04 +0200
commit9ab5c9dbd495d3bd0b9bec88f8a5db7213fc30c7 (patch)
tree0caaf8f57271d829e89d4db5cf03c51043bbe686 /lib/rhbzpage.js
parent9f1bc2cfff3bfd7050c7dfd1c02954347923f643 (diff)
downloadbugzilla-triage-9ab5c9dbd495d3bd0b9bec88f8a5db7213fc30c7.tar.gz
Fix RHBugzillaPage.addClosingUpstream and BZPage.selectOptionByLabel method
Fixes #32
Diffstat (limited to 'lib/rhbzpage.js')
-rw-r--r--lib/rhbzpage.js31
1 files changed, 10 insertions, 21 deletions
diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js
index 92c6e28..81c63fe 100644
--- a/lib/rhbzpage.js
+++ b/lib/rhbzpage.js
@@ -688,7 +688,7 @@ RHBugzillaPage.prototype.analyzeXorgLog = function analyzeXorgLog(attachID) {
* @param URLhostname String hostname of the external bugzilla
* @return String with the string for the external_id SELECT
*/
-RHBugzillaPage.prototype.getBugzillaName = function(URLhostname) {
+RHBugzillaPage.prototype.getBugzillaName = function getBugzillaName(URLhostname) {
var bugzillaID = "";
var bzLabelNames = JSON.parse(self.data.load("bugzillalabelNames.json"));
if (bzLabelNames[URLhostname]) {
@@ -708,7 +708,7 @@ RHBugzillaPage.prototype.getBugzillaName = function(URLhostname) {
* + responseHeaders
* + responseText
*/
-RHBugzillaPage.prototype.fixingMIMECallBack = function() {
+RHBugzillaPage.prototype.fixingMIMECallBack = function fixingMIMECallBack() {
var that = this;
if (--this.reqCounter <= 0) {
timer.setTimeout(function () {
@@ -817,33 +817,25 @@ RHBugzillaPage.prototype.addTextLink = function(row) {
RHBugzillaPage.prototype.addClosingUpstream = function() {
var refs = this.doc.getElementById("external_bugs_table")
.getElementsByTagName("tr");
+
// that's a bad id, if there is a one. :)
var inputBox = this.doc.getElementById("inputbox");
var externalBugID = 0;
var wholeURL = "";
- // TODO Hopefully unfinished and even less tested
// Fix missing ID on the external_id SELECT
- this.doc.getElementsByName("external_id")[0].setAttribute("id",
+ this.doc.getElementsByName("external_id")[0].setAttribute("id",
"external_id");
if (inputBox.value.match(/^http.*/)) {
- wholeURL = inputBox.value;
- var helpURL = new url.URL(wholeURL);
- var paramsArr = helpURL.path.replace(/^\?/, '').split('&');
- // get convert URL parameters to an Object
- var params = {}, s = [];
- paramsArr.forEach(function(par, idx, arr) {
- s = par.split('=');
- params[s[0]] = s[1];
- });
- if (params.id) {
- externalBugID = parseInt(params.id, 10);
+ var wholeURL= new url.URL(inputBox.value);
+ var externalBugID = util.getBugNo(wholeURL);
+ if (externalBugID) {
inputBox.value = externalBugID;
}
- // get host and bugzillaName
- var bugzillaName = this.getBugzillaName(helpURL.hostname);
- this.selectOption("external_id", bugzillaName);
+ // get bugzillaName and set the label
+ var bugzillaName = this.getBugzillaName(wholeURL.host);
+ this.selectOptionByLabel("external_id", bugzillaName);
} else if (!isNaN(inputBox.value)) {
externalBugID = parseInt(inputBox.value, 10);
var bugzillaHostname = this.doc.getElementById("external_id").value;
@@ -853,9 +845,6 @@ RHBugzillaPage.prototype.addClosingUpstream = function() {
// the previous commit?
}
- // TODO THis is not good, we don't have a feedback for other commands,
- // not to be run, if this fails.
-
// It is not good to close bug as UPSTREAM, if there is no reference
// to the upstream bug.
if ((externalBugID > 0) || (refs.length > 2)) {