aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libbugzilla.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-03-07 17:46:43 +0100
committerMatěj Cepl <mcepl@redhat.com>2011-03-07 17:46:43 +0100
commit0c54ada8588dc27ab69ccc3b385a8fc6a8c89251 (patch)
treed1582aa5a3b158939db49d7055f631dc572266e1 /lib/libbugzilla.js
parentc1ec772b104316530f6737340355205398df33af (diff)
downloadbugzilla-triage-0c54ada8588dc27ab69ccc3b385a8fc6a8c89251.tar.gz
Config_data.json should have "all" for bugzilla.redhat.com not "any"
Also: * remove all trailing spaces * with "all" just add packages, don't replace other ones.
Diffstat (limited to 'lib/libbugzilla.js')
-rw-r--r--lib/libbugzilla.js31
1 files changed, 15 insertions, 16 deletions
diff --git a/lib/libbugzilla.js b/lib/libbugzilla.js
index 1c5f7a2..14fd675 100644
--- a/lib/libbugzilla.js
+++ b/lib/libbugzilla.js
@@ -60,7 +60,7 @@ function getRealBugNo(bugNo, location, callback) {
onComplete: function(response) {
if (response.status === 200) {
var xmlRepr = parseXMLfromString(response.text);
- // TODO this is probably wrong, both XPath and .text attribute
+ // TODO this probably wrong, both XPath and .text attribute
var bugID = parseInt(xmlRepr.bug.bug_id.text, 10);
if (isNaN(bugID)) {
throw new Error("Cannot get bug no. even from XML representation!");
@@ -77,14 +77,14 @@ exports.getPassword = function getPassword(login, domain, callback) {
var switchPrompt = "Do you want to switch off features requiring password completely";
var prefName = BTSPrefNS+"withoutPassowrd";
var domain = window.location.protocol + "//" + window.location.hostname;
-
+
var pass = passUtils.getPassword(login,
domain, BTSPassRealm);
var retObject = {
password: null,
withoutPass: false
};
-
+
// pass === null means no appropriate password in the storage
if (!preferences.get(prefName,false) && (pass === null)) {
passwordText = prompts.promptPassword(passPrompt);
@@ -108,13 +108,13 @@ exports.getPassword = function getPassword(login, domain, callback) {
exports.changeJSONURL = function changeJSONURL() {
var prfNm = BTSPrefNS+"JSONURL";
var url = preferences.get(prfNm,"");
-
+
var reply = prompts.prompt("New location of JSON configuration file", url);
if (reply) {
preferences.set(prfNm, reply.trim());
// TODO Restartless add-on needs to resolve this.
prompts.alert("For now, you should really restart Firefox!");
- }
+ }
};
/**
@@ -125,7 +125,7 @@ exports.changeJSONURL = function changeJSONURL() {
exports.getInstalledPackages = function getInstalledPackages(location, config, callback) {
var installedPackages = {};
var enabledPackages = [];
-
+
if (typeof location == "string") {
location = new urlMod.URL(location);
}
@@ -145,11 +145,10 @@ exports.getInstalledPackages = function getInstalledPackages(location, config, c
}
}
- if ((enabledPackages.length === 1) && (enabledPackages[0] === "all")) {
- enabledPackages = [];
- for (var key in config.gJSONData.commentPackages) {
- enabledPackages.push(key);
- }
+ var allIdx = null;
+ if ((allIdx = enabledPackages.indexOf("all")) != -1) {
+ enabledPackages = enabledPackages.splice(allIdx,
+ config.gJSONData.commentPackages.keys());
}
// TODO To be decided, whether we cannot just eliminate packages in
@@ -160,7 +159,7 @@ exports.getInstalledPackages = function getInstalledPackages(location, config, c
}
});
}
-
+
// Expand commentIdx properties into full comments
var cmdObj = {};
for (var pkgKey in installedPackages) {
@@ -168,11 +167,11 @@ exports.getInstalledPackages = function getInstalledPackages(location, config, c
cmdObj = installedPackages[pkgKey][cmdObjKey];
if ("commentIdx" in cmdObj) {
cmdObj.comment = config.gJSONData.commentStrings[cmdObj.commentIdx];
- delete cmdObj.commentIdx;
+ delete cmdObj.commentIdx;
}
}
}
-
+
callback(new Message("CreateButtons", {
instPkgs: installedPackages,
constData: config.constantData,
@@ -253,7 +252,7 @@ exports.initialize = function initialize(config, callback) {
// config.objConstructor = require("mozillabzpage").MozillaBugzilla;
// callback(config);
-
+
config.constantData = {};
// TODO this is important and missing
if ("constantData" in config.gJSONData) {
@@ -263,7 +262,7 @@ exports.initialize = function initialize(config, callback) {
config.constantData.XMLRPCData = JSON.parse(
selfMod.data.load("XMLRPCdata.json"));
}
-
+
if ("CCmaintainer" in config.constantData) {
config.defBugzillaMaintainerArr = config.constantData.CCmaintainer;
}