diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-04-22 04:05:34 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-06-05 14:46:49 +0200 |
commit | 738734fc32b9d0c52b89208c708fd6a6f3cc0531 (patch) | |
tree | 1ccc5a00cee064dc9c47f90eae7e287772eb5e8d /data | |
parent | fea37bf96ab3b0494a44f9737061898260dc5d41 (diff) | |
download | bugzilla-triage-738734fc32b9d0c52b89208c708fd6a6f3cc0531.tar.gz |
Make the categories work only for Xorg bugs.
Diffstat (limited to 'data')
-rw-r--r-- | data/lib/otherButtons.js | 5 | ||||
-rw-r--r-- | data/lib/rhbzpage.js | 4 | ||||
-rw-r--r-- | data/lib/util.js | 2 | ||||
-rw-r--r-- | data/lib/xorgBugCategories.js | 27 |
4 files changed, 26 insertions, 12 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 8071c80..bce5ac1 100644 --- a/data/lib/rhbzpage.js +++ b/data/lib/rhbzpage.js @@ -469,7 +469,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 b145d25..c2989d2 100644 --- a/data/lib/util.js +++ b/data/lib/util.js @@ -284,7 +284,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 + "]"; |