* Fix bug for getting all objects when one label is not exist.

This commit is contained in:
dingguodong
2021-09-23 16:54:22 +08:00
parent 5c4ae3dbf5
commit 1762865528
+8
View File
@@ -92,8 +92,13 @@ class productIssuesEntry extends entry
$taskTypeMap = array_flip($this->app->lang->task->typeList);
$bugTypeMap = array_flip($this->app->lang->bug->typeList);
$labelExistStatus = array(); /* Set this value to judge if label is not exist. Exist => true, not Exist => false. */
$objectTypeMap = array_merge(array_keys(array_merge($storyTypeMap, $taskTypeMap, $bugTypeMap)), array($this->app->lang->story->common, $this->app->lang->task->common, $this->app->lang->bug->common));
foreach($labels as $label)
{
/* Set label exist status. */
$labelExistStatus[$label] = in_array($label, $objectTypeMap) ? true : false;
if($label == $this->app->lang->story->common) $storyFilter[] = 'all';
if(isset($storyTypeMap[$label])) $storyFilter[] = $storyTypeMap[$label];
@@ -103,6 +108,9 @@ class productIssuesEntry extends entry
if($label == $this->app->lang->bug->common) $bugFilter[] = 'all';
if(isset($bugTypeMap[$label])) $bugFilter[] = $bugTypeMap[$label];
}
/* Return empty result if one label is not exists. We assume user usually input one label to search by labels. */
if(in_array(false, $labelExistStatus) and empty($storyFilter) and empty($taskFilter) and empty($bugFilter)) $this->send(200, array('page' => $page, 'total' => 0, 'limit' => $limit, 'issues' => array()));
}
if(!empty($storyFilter)) $labelTypes[] = 'story';