aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-04-22 04:05:34 +0200
committerMatěj Cepl <mcepl@redhat.com>2011-04-22 04:05:34 +0200
commit62dc530470d6e6ec82f8c50dc65d7ddbb742748c (patch)
treece95b1289e851f64221475d7fde58afd1adf5428
parent716ea4208690274449e93ce01bf54646621fbb3e (diff)
downloadbugzilla-triage-62dc530470d6e6ec82f8c50dc65d7ddbb742748c.tar.gz
Make the categories work only for Xorg bugs.
-rw-r--r--data/lib/otherButtons.js5
-rw-r--r--data/lib/rhbzpage.js4
-rw-r--r--data/lib/util.js2
-rw-r--r--data/lib/xorgBugCategories.js27
-rw-r--r--lib/main.js2
5 files changed, 27 insertions, 13 deletions
diff --git a/data/lib/otherButtons.js b/data/lib/otherButtons.js
index 7a11395..1cca24b 100644
--- a/data/lib/otherButtons.js
+++ b/data/lib/otherButtons.js
@@ -67,8 +67,8 @@ function markBugTriaged() {
}
}
-function addingEmbelishments(list) {
var FillMagicDoneRE = new RegExp("^\\s*\\[[0-9a-zA-Z_]*\\]");
+function addingEmbelishments(list) {
var maintCCAddr = "";
if (constantData.CCmaintainer) {
@@ -142,7 +142,8 @@ function setBranding(xLogAtts) {
brandColor = RHColor;
}
}
- else if (new RegExp("Fedora").test(document.getElementById("product").value)) {
+ else if (new RegExp("Fedora").test(document.
+ getElementById("product").value)) {
if (document.getElementById("version").value === "rawhide") {
brandColor = RawhideColor;
}
diff --git a/data/lib/rhbzpage.js b/data/lib/rhbzpage.js
index d36f33c..327a1bf 100644
--- a/data/lib/rhbzpage.js
+++ b/data/lib/rhbzpage.js
@@ -467,7 +467,9 @@ function RHBZinit() {
}
if (constantData.xorgBugsCategories) {
- makeBugCategoriesList(constantData.xorgBugsCategories);
+ var XBZlist = filterByRegexp(constantData.
+ xorgBugsCategories, getComponent());
+ makeBugCategoriesList(XBZlist);
}
// Dig out backtrace protection against double-firing?
diff --git a/data/lib/util.js b/data/lib/util.js
index 5859f97..1bdbcde 100644
--- a/data/lib/util.js
+++ b/data/lib/util.js
@@ -280,7 +280,7 @@ function filterByRegexp(list, chosingMark) {
return chosenPair[0].addr;
}
else {
- return "";
+ return null;
}
}
diff --git a/data/lib/xorgBugCategories.js b/data/lib/xorgBugCategories.js
index f47ad1d..8168f18 100644
--- a/data/lib/xorgBugCategories.js
+++ b/data/lib/xorgBugCategories.js
@@ -6,15 +6,23 @@ function hasXorgBugsCategory() {
var catRE = /\s*\[cat:.*?\]\s*/; // RE for testing whether
// there is already category tag in the Whiteboard
+ var isXOrgBug = filterByRegexp(constantData.
+ xorgBugsCategories, getComponent());
+ console.myDebug("isXOrgBug = " + isXOrgBug);
var whiteboardContent = document.
getElementById("status_whiteboard").value;
- return (catRE.test(whiteboardContent));
+ console.myDebug("whiteboardContent = " + whiteboardContent);
+ console.myDebug("catRE.test = " + catRE.test(whiteboardContent));
+
+ return (isXOrgBug && catRE.test(whiteboardContent));
}
/**
* Create a category list to the upper toolbar
*/
function makeBugCategoriesList(catList) {
+ var catRE = /\s*\[cat:.*?\]\s*/; // RE for testing whether
+ // there is already category tag in the Whiteboard
// Create <select> element and add it first blank <option>
var targetDiv = document.getElementById("commit_top").parentNode;
@@ -28,13 +36,16 @@ function makeBugCategoriesList(catList) {
categoryList.appendChild(optionElement);
// Fill-in <select> with <options>s for each category one
- catList.forEach(function (cat) {
- optionElement = document.createElement("option");
- optionElement.value = cat;
- optionElement.setAttribute("id", "catId_" + cat.replace(" ","").toLowerCase());
- optionElement.appendChild(document.createTextNode(cat));
- categoryList.appendChild(optionElement);
- });
+ if (catList) {
+ catList.forEach(function (cat) {
+ optionElement = document.createElement("option");
+ optionElement.value = cat;
+ optionElement.setAttribute("id", "catId_" +
+ cat.replace(" ","").toLowerCase());
+ optionElement.appendChild(document.createTextNode(cat));
+ categoryList.appendChild(optionElement);
+ });
+ }
categoryList.addEventListener("change", function (evt) {
var selectedCategory = "[cat:" + this.value + "]";
diff --git a/lib/main.js b/lib/main.js
index 645669a..849da68 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -118,11 +118,11 @@ var contentScriptLibraries = [
self.data.url("lib/jumpNextBug.js"),
self.data.url("lib/queries.js"),
self.data.url("lib/preprocessDuplicates.js"),
- self.data.url("lib/xorgBugCategories.js"),
self.data.url("lib/viewSource.js"),
self.data.url("lib/color.js"),
self.data.url("lib/addNewLinks.js"),
self.data.url("lib/bugzillaDOMFunctions.js"),
+ self.data.url("lib/xorgBugCategories.js"),
self.data.url("lib/otherButtons.js"),
self.data.url("lib/makeBacktraceAttachment.js"),
self.data.url("lib/fixingAttMIME.js"),