* Optimize responseAfterDelete function.

This commit is contained in:
wangyuting
2023-05-31 13:48:49 +08:00
parent 6f3fcab1d2
commit fc7a49e149
2 changed files with 9 additions and 9 deletions
+3 -1
View File
@@ -572,7 +572,9 @@ class bug extends control
}
}
return $this->bugZen->responseAfterDelete($bug, $from);
$message = $this->executeHooks($bugID);
if(!$message) $message = $this->lang->saveSuccess;
return $this->bugZen->responseAfterDelete($bug, $from, $message);
}
/**
+6 -8
View File
@@ -1915,14 +1915,12 @@ class bugZen extends bug
*
* @param object $bug
* @param string $from
* @param string $message
* @access protected
* @return array
* @return void
*/
protected function responseAfterDelete(object $bug, string $from): array
protected function responseAfterDelete(object $bug, string $from, string $message): void
{
$message = $this->executeHooks($bugID);
if(!$message) $message = $this->lang->saveSuccess;
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $message));
/* 在弹窗中删除 bug 时的返回。*/
@@ -1933,9 +1931,9 @@ class bugZen extends bug
/* Respond when delete in task kanban. */
if($from == 'taskkanban')
{
$laneType = $this->session->executionLaneType ?: 'all';
$groupBy = $this->session->executionGroupBy ?: 'default';
$searchValue = $this->session->taskSearchValue ?: '';
$laneType = $this->session->executionLaneType ? $this->session->executionLaneType : 'all';
$groupBy = $this->session->executionGroupBy ? $this->session->executionGroupBy : 'default';
$searchValue = $this->session->taskSearchValue ? $this->session->taskSearchValue : '';
$kanbanData = $this->loadModel('kanban')->getExecutionKanban($bug->execution, $laneType, $groupBy, $searchValue);
$kanbanType = $laneType == 'all' ? 'bug' : key($kanbanData);
$kanbanData = json_encode($kanbanData[$kanbanType]);