aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-08-19 14:17:30 -0400
committerMatěj Cepl <mcepl@redhat.com>2010-08-19 14:54:43 -0400
commit3c7ce2acd32114ba6a9e49aa8af23516261e3c6f (patch)
tree8e7dc949f1087c30d2a2a73b5c1ba336e604c648
parent3ace26856d4fb2ea82de39ec7a97a7fb1c0c63ca (diff)
downloadbugzilla-triage-3c7ce2acd32114ba6a9e49aa8af23516261e3c6f.tar.gz
Make skipping attachments working
- add attachment.cgi$ to skipMatches regexp - NotLoggedinException should be caught in main.js not in rhbzpage.js Fixes #41 New release 0.18
-rw-r--r--lib/main.js20
-rw-r--r--lib/rhbzpage.js11
-rw-r--r--package.json2
-rw-r--r--update.rdf19
4 files changed, 34 insertions, 18 deletions
diff --git a/lib/main.js b/lib/main.js
index a8bae4c..25498d6 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -39,15 +39,13 @@ function isOurPage(window, matchingURLs) {
*/
function skipThisPage(doc) {
var stemURL = "https://HOSTNAME/show_bug.cgi?id=";
- var titleStr = doc.getElementsByTagName("title")[0].textContent;
+ var titleElems = doc.getElementsByTagName("title");
+ console.log("titleElems.length = " + titleElems.length);
+ var titleStr = titleElems[0].textContent;
var REArr = new RegExp("[bB]ug\\s+([0-9]+)").exec(titleStr);
var hostname = doc.location.hostname;
if (REArr) {
var bugNo = REArr[1];
- var emailsSent = doc.
- querySelector("#bugzilla-body > dl:nth-of-type(1)").textContent;
- emailsSent = emailsSent.replace(/^(\s*)$/mg,"");
- prompts.notification(emailsSent);
doc.location = stemURL.replace("HOSTNAME",hostname) + bugNo;
}
}
@@ -102,7 +100,7 @@ function initialize(callback) {
config.matches = config.gJSONData.configData.matches;
config.skipMatches = config.matches.map(function(x) {
- return x.replace("show_bug.cgi.*","(process|post)_bug.cgi");
+ return x.replace("show_bug.cgi.*","((process|post)_bug|attachment)\.cgi$");
});
callback(config);
@@ -126,7 +124,15 @@ exports.main = function main(options, callbacks) {
construct = require("mozillabzpage").MozillaBugzilla;
}
if (isOurPage(window, config.matches)) {
- var curPage = new construct(window, config);
+ try {
+ var curPage = new construct(window, config);
+ } catch (ex) {
+ if (ex instanceof require("bzpage").NotLoggedinException) {
+ return ; // Bail out if the user is not logged in
+ } else {
+ throw ex; // rethrow the exception otherwise
+ }
+ }
} else if (isOurPage(window, config.skipMatches)) {
skipThisPage(window.document);
}
diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js
index e858145..b55e44b 100644
--- a/lib/rhbzpage.js
+++ b/lib/rhbzpage.js
@@ -21,16 +21,7 @@ var NumberOfFrames = require("bzpage").NumberOfFrames;
var RHBugzillaPage = function RHBugzillaPage(win, config) {
// inheritance ... call superobject's constructor
- try {
- BZPage.call(this, win, config);
- } catch (ex) {
- if (ex instanceof require("bzpage").NotLoggedinException) {
- console.log(ex);
- return ; // Bail out if the user is not logged in
- } else {
- throw ex; // rethrow the exception otherwise
- }
- }
+ BZPage.call(this, win, config);
// For identification of graphics card
this.manuChipStrs = [ [ "ATI Radeon", "ATI", "1002" ],
diff --git a/package.json b/package.json
index cf7237f..86328aa 100644
--- a/package.json
+++ b/package.json
@@ -7,5 +7,5 @@
"description": "Additional buttons and other function helping in the triage on bugzilla",
"author": "Matej Cepl (http://matej.ceplovi.cz)",
"license": "MIT/X11 (http://opensource.org/licenses/mit-license.php)",
- "version": "0.17"
+ "version": "0.18"
}
diff --git a/update.rdf b/update.rdf
index fb5763f..4e84302 100644
--- a/update.rdf
+++ b/update.rdf
@@ -62,6 +62,25 @@
<em:updateHash>79892e43899a2decfedbb24ea22906443ce37fe6</em:updateHash>
</RDF:Description>
</RDF:li>
+ <RDF:li>
+ <RDF:Description>
+ <em:version>0.18</em:version> <!-- This is the version number of the add-on -->
+ <!-- One targetApplication for each application the add-on is compatible with -->
+ <em:targetApplication>
+ <RDF:Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>3.6</em:minVersion>
+ <em:maxVersion>4.*</em:maxVersion>
+ </RDF:Description>
+ </em:targetApplication>
+ <!-- This is where this version of the add-on will be downloaded from -->
+ <em:updateLink>https://fedorahosted.org/released/bugzilla-triage-scripts/bugzilla-triage-0.17.xpi</em:updateLink>
+
+ <!-- A page describing what is new in this updated version -->
+ <em:updateInfoURL>https://fedorahosted.org/bugzilla-triage-scripts/wiki/ChangeLog</em:updateInfoURL>
+ <em:updateHash>de3446a5ca8fb10a42d510bb11fbba0e5251edb9</em:updateHash>
+ </RDF:Description>
+ </RDF:li>
</RDF:Seq>
</em:updates>
</RDF:Description>