aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2012-09-15 10:38:59 +0200
committerMatěj Cepl <mcepl@redhat.com>2012-09-19 08:19:50 +0200
commitb18e93d73dadacb1d36f0e0fa7a19bbb188e8d75 (patch)
tree3c110c085d8a8a8b2734a68d7c0a60ba3cb06728
parent065050a6a64761ca9e76ea4bbd9b90343c1ccfa4 (diff)
downloadbugzilla-triage-b18e93d73dadacb1d36f0e0fa7a19bbb188e8d75.tar.gz
Fix calls of bugzilla.updateAttachMimeType to the new API.
Bugzilla guys are working on fix, but they provided workaround. Fixes #124
-rw-r--r--data/lib/collectingMetadata.js3
-rw-r--r--data/lib/rpcutils.js3
-rw-r--r--data/rhlib/fixingAttMIME.js24
-rw-r--r--lib/main.js1
4 files changed, 22 insertions, 9 deletions
diff --git a/data/lib/collectingMetadata.js b/data/lib/collectingMetadata.js
index 4ed24b5..de07089 100644
--- a/data/lib/collectingMetadata.js
+++ b/data/lib/collectingMetadata.js
@@ -87,6 +87,7 @@ function Attachment(inElem) {
// getting MIME type and size
var stringArray = inElem.getElementsByClassName("bz_attach_extra_info")[0].
textContent.replace(/[\n ()]+/g, " ").trim().split(", ");
+ this.bugId = getBugNo();
this.size = parseInt(stringArray[0], 10);
this.mimeType = stringArray[1].split(" ")[0];
this.element = inElem;
@@ -170,7 +171,7 @@ AttachList.prototype.markBadAttachments = function markBadAttachments() {
createDeadLink("fixAllButton", "Fix all", titleElement, function () {
Array.forEach(badAttachments, function (x) {
- fixAttachById(x.id);
+ fixAttachById(x.bugId, x.id);
});
}, [], false, null, "f");
badAttachments.forEach(function (x, i, a) {
diff --git a/data/lib/rpcutils.js b/data/lib/rpcutils.js
index 74b3ded..b0af0ef 100644
--- a/data/lib/rpcutils.js
+++ b/data/lib/rpcutils.js
@@ -26,7 +26,7 @@ function makeJSONRPCCall(method, params, callback) {
var JSONresponse = JSON.parse(req.responseText);
if ("error" in JSONresponse) {
throw new Error("Error in JSON-RPC call:\n" +
- JSONresponse.error);
+ JSONresponse.error.toSource());
}
callback(JSONresponse);
}
@@ -38,4 +38,3 @@ function makeJSONRPCCall(method, params, callback) {
req.setRequestHeader('Content-Type', "application/json");
req.send(JSON.stringify(msg));
};
-
diff --git a/data/rhlib/fixingAttMIME.js b/data/rhlib/fixingAttMIME.js
index 220b7ad..56e10ba 100644
--- a/data/rhlib/fixingAttMIME.js
+++ b/data/rhlib/fixingAttMIME.js
@@ -44,24 +44,37 @@ function XMLRPCcallback() {
* this change };
*
*/
-function fixAttachById(id, type, email) {
+function fixAttachById(bugId, id, type, email) {
+ myDebug("bugId = " + bugId + ", id = " + id);
if (type === undefined) {
type = "text/plain";
}
if (email === undefined) {
- email = false;
+ email = 0;
+ }
+
+ // Logic of nomail is negative ... turn around
+ email = !email;
+
+ if (email === true) {
+ email = 1;
+ }
+ else {
+ email = 0;
}
// https://bugzilla.redhat.com/\
// docs/en/html/api/extensions/compat_xmlrpc/code/webservice.html
// test on https://bugzilla.redhat.com/show_bug.cgi?id=485145
var params = {
+ 'id': bugId,
'attach_id' : id,
'mime_type' : type,
- 'nomail' : !email
+ 'nomail' : email
};
- makeJSONRPCCall("bugzilla.updateAttachMimeType", params, XMLRPCcallback);
+ // makeJSONRPCCall("bugzilla.updateAttachMimeType", params, XMLRPCcallback);
+ makeJSONRPCCall("RedHat.updateAttachMimeType", params, XMLRPCcallback);
reqCounter++;
}
@@ -75,6 +88,7 @@ function fixAttachById(id, type, email) {
function addTextLink(att) {
var elemS = att.element.getElementsByTagName("td");
var elem = elemS[elemS.length - 1];
+ myDebug("att = " + att.toSource());
createDeadLink("addFix2TextLink", "text", elem, fixAttachById,
- [ att.id ], "br");
+ [ att.bugId, att.id ], "br");
}
diff --git a/lib/main.js b/lib/main.js
index 49cffd0..f5c4bc5 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -10,7 +10,6 @@
//http://ehsanakhgari.org/blog/2010-05-31/my-experience-jetpack-sdk#comment-1253
"use strict";
-var browser = require("tab-browser");
var self = require("self");
var pageMod = require("page-mod");
var libbz = require("libbugzilla");