diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-04-22 04:57:30 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-04-22 12:20:31 +0200 |
commit | 3fba7044de4b09e12077a6ef3dbb5d0fad9580e5 (patch) | |
tree | e22319929b64615842485100af2dc698e51d06bf /data/lib | |
parent | 44f5320786bf11d36a93a8afce059dec93084361 (diff) | |
download | bugzilla-triage-3fba7044de4b09e12077a6ef3dbb5d0fad9580e5.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/lib')
-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 327a1bf..55e0cc5 100644 --- a/data/lib/rhbzpage.js +++ b/data/lib/rhbzpage.js @@ -469,7 +469,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; + } } /** |