diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-04-22 04:57:30 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-06-05 14:46:49 +0200 |
commit | 2a04c3fc60e4f9cd8b59cbe6bcfbd56d0e29c98f (patch) | |
tree | 7710cf2dc8ca319bf995859babc45fa797c042b2 /data | |
parent | fe02d1337e9f4377b381f311efb8224a50ef8903 (diff) | |
download | bugzilla-triage-2a04c3fc60e4f9cd8b59cbe6bcfbd56d0e29c98f.tar.gz |
Fixed other functions broken
* not all functions are able to accept the null as return value (directly
or indirectly) of filterByRegexp
* finally make all logic not to affect components which shouldn't be
bothered with the test.
Diffstat (limited to 'data')
-rw-r--r-- | data/lib/bugzillaDOMFunctions.js | 3 | ||||
-rw-r--r-- | data/lib/otherButtons.js | 4 | ||||
-rw-r--r-- | data/lib/queries.js | 3 | ||||
-rw-r--r-- | data/lib/rhbzpage.js | 4 | ||||
-rw-r--r-- | data/lib/xorgBugCategories.js | 18 |
5 files changed, 23 insertions, 9 deletions
diff --git a/data/lib/bugzillaDOMFunctions.js b/data/lib/bugzillaDOMFunctions.js index 30405f0..0f22020 100644 --- a/data/lib/bugzillaDOMFunctions.js +++ b/data/lib/bugzillaDOMFunctions.js @@ -133,8 +133,7 @@ function getOwner () { * @return String with the maintainer's email address */ function getDefaultBugzillaMaintainer (component) { - var address = filterByRegexp(constantData.defBugzillaMaintainerArr, component); - return address; + return filterByRegexp(constantData.defBugzillaMaintainerArr, component); } /** diff --git a/data/lib/otherButtons.js b/data/lib/otherButtons.js index 1cca24b..2f93ea7 100644 --- a/data/lib/otherButtons.js +++ b/data/lib/otherButtons.js @@ -33,7 +33,7 @@ function collectComments () { */ function getDefaultAssignee() { return filterByRegexp(constantData.defaultAssignee, - getComponent()).toLowerCase(); + getComponent()); } /** @@ -46,7 +46,7 @@ function setDefaultAssignee() { var defAss = getDefaultAssignee(); // Add setting default assignee - if ((defAss.length > 0) && (defAss !== getOwner())) { + if (defAss && (defAss !== getOwner())) { createNewButton("bz_assignee_edit_container",true, { "name": "Def. Assignee", "assignee": "default" diff --git a/data/lib/queries.js b/data/lib/queries.js index 0c00792..7f935c8 100644 --- a/data/lib/queries.js +++ b/data/lib/queries.js @@ -78,6 +78,9 @@ function queryForSelection() { */ function queryUpstreamCallback(text, queryUpBug) { var searchData = filterByRegexp(queryUpBug, getComponent()); + if (!searchData) { + return ; // not sure why it should happen, but certainly better + } var urlBase = searchData.url; text = searchData.searchBy+":"+searchData.fillIn+" "+text.trim(); if (searchData.fillIn == "$$$") { diff --git a/data/lib/rhbzpage.js b/data/lib/rhbzpage.js index bce5ac1..22e3178 100644 --- a/data/lib/rhbzpage.js +++ b/data/lib/rhbzpage.js @@ -471,7 +471,9 @@ function RHBZinit() { if (constantData.xorgBugsCategories) { var XBZlist = filterByRegexp(constantData. xorgBugsCategories, getComponent()); - makeBugCategoriesList(XBZlist); + if (XBZlist) { + makeBugCategoriesList(XBZlist); + } } // Dig out backtrace protection against double-firing? diff --git a/data/lib/xorgBugCategories.js b/data/lib/xorgBugCategories.js index 8168f18..c2c9c9b 100644 --- a/data/lib/xorgBugCategories.js +++ b/data/lib/xorgBugCategories.js @@ -2,19 +2,29 @@ // http://www.opensource.org/licenses/mit-license.php "use strict"; +/** + * Returns true if the bug is in a good shape + * + * @return Boolean if the bug is either not in the category + * where we care about it (i.e., we don't have set up categories for + * this component) or if it is in the concerned categories, then it has + * a category recorded in the whiteboard input box. + * + */ 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; - console.myDebug("whiteboardContent = " + whiteboardContent); - console.myDebug("catRE.test = " + catRE.test(whiteboardContent)); - return (isXOrgBug && catRE.test(whiteboardContent)); + if (isXOrgBug) { // is it XOR? + return catRE.test(whiteboardContent); + } else { + return true; + } } /** |