* [misc,done,0.1h] optimize code.

This commit is contained in:
tianshujie
2025-02-14 10:35:08 +08:00
committed by xieqiyu
parent 40d03ae62d
commit d15618bbb9
+8 -8
View File
@@ -1213,6 +1213,13 @@ class bugZen extends bug
*/
protected function assignVarsForEdit(object $bug): void
{
/* Add product related to the bug when it is not in the products. */
if(!isset($this->products[$bug->product]))
{
$this->products[$bug->product] = $product->name;
$this->view->products = $this->products;
}
$product = $this->loadModel('product')->fetchByID($bug->product);
if(empty($product->shadow))
{
@@ -1220,18 +1227,11 @@ class bugZen extends bug
$productList = $this->loadModel('product')->getByIdList(array_keys($products));
foreach($products as $id => $name)
{
if(!empty($productList[$id]->shadow) || $productList[$id]->status == 'closed') unset($products[$id]);
if($id != $bug->product && (!empty($productList[$id]->shadow) || $productList[$id]->status == 'closed')) unset($products[$id]);
}
$this->view->products = $products;
}
/* Add product related to the bug when it is not in the products. */
if(!isset($this->products[$bug->product]))
{
$this->products[$bug->product] = $product->name;
$this->view->products = $this->products;
}
if($bug->execution)
{
$openedBuilds = $this->loadModel('build')->getBuildPairs(array($bug->product), $bug->branch, 'noempty,noterminate,nodone,withbranch,noreleased,nofail', $bug->execution, 'execution');