aboutsummaryrefslogtreecommitdiffstats
path: root/bugzillaBugTriage.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-05-03 14:05:38 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-05-03 14:05:38 +0200
commit39c56d15058d38c04c923f5b7b0ff728f7520317 (patch)
tree245cd8c53b2deaf45761a37c6cc49ab53dde707b /bugzillaBugTriage.js
parent389997c33d6e66768e3effa407939b7a94612a42 (diff)
downloadbugzilla-triage-39c56d15058d38c04c923f5b7b0ff728f7520317.tar.gz
- move getting login address of the user to a special method of BZPage
object - add plenty of logging calls - fix Object.prototype.create so that a newly created object doesn't contain it
Diffstat (limited to 'bugzillaBugTriage.js')
-rw-r--r--bugzillaBugTriage.js26
1 files changed, 21 insertions, 5 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js
index d8f2ebf..1287132 100644
--- a/bugzillaBugTriage.js
+++ b/bugzillaBugTriage.js
@@ -275,8 +275,9 @@ XMLRPCMessage.prototype.getParamXML = function(type, data) {
*/
if (typeof Object.create !== 'function') {
Object.prototype.create = function () {
- function F() {}
+ function F() {};
F.prototype = this;
+ delete F.prototype.create;
return new F();
};
}
@@ -918,6 +919,21 @@ BZPage.prototype.addNewButton = function(originalLocation, newId, newLabel,
}
};
+/**
+ * Get login of the currently logged-in user.
+ *
+ * @return String with the login name of the currently logged-in user
+ */
+BZPage.prototype.getLogin = function () {
+ var lastLIElement = this.doc.querySelector("#header ul.links li:last-of-type");
+ console.log("Testing element:\n"+ lastLIElement);
+ console.log("Testing element.textContent:\n"+ lastLIElement.textContent);
+ var loginArr = lastLIElement.textContent.split("\n");
+ console.log("loginArr = " + loginArr.toSource());
+ var loginStr = loginArr[loginArr.length - 1].trim();
+ console.log("loginStr = " + loginStr);
+ return loginStr;
+}
// ====================================================================================
// MozillaBugzilla object
@@ -957,10 +973,8 @@ function RHBugzillaPage(doc) {
this.doc = doc;
var that = this;
this.originalButton = this.doc.getElementById("commit");
-
- var loginArr = this.doc.querySelector("#header ul.links li:last-of-type").textContent
- .split("\n");
- this.login = loginArr[loginArr.length - 1].trim();
+
+ this.login = this.getLogin();
if (myStorage.BZpassword) {
this.password = myStorage.BZpassword;
@@ -1938,6 +1952,7 @@ RHBugzillaPage.prototype.fixAttachById = function(id, type, email) {
}
var msg = new XMLRPCMessage("bugzilla.updateAttachMimeType");
+ console.log("XML-RPC before:\n"+msg.xml())
msg.addParameter( {
'attach_id' : id,
'mime_type' : type,
@@ -1945,6 +1960,7 @@ RHBugzillaPage.prototype.fixAttachById = function(id, type, email) {
});
msg.addParameter(this.login);
msg.addParameter(this.password);
+ console.log("XML-RPC message:\n"+msg.xml());
var req = new XMLHttpRequest();
var that = this;