* Optimize bug delete function.
This commit is contained in:
@@ -546,7 +546,7 @@ class bug extends control
|
||||
*/
|
||||
public function delete(string $bugID, string $confirm = 'no', string $from = '')
|
||||
{
|
||||
if($confirm == 'no') return $this->send(array('result' => 'success', 'load' => array('confirm' => $this->lang->bug->confirmDelete, 'confirmed' =>inlink('delete', "bugID=$bugID&confirm=yes&from=$from"))));
|
||||
if($confirm == 'no') return $this->send(array('result' => 'success', 'load' => array('confirm' => $this->lang->bug->confirmDelete, 'confirmed' => inlink('delete', "bugID=$bugID&confirm=yes&from=$from"))));
|
||||
|
||||
$bug = $this->bug->getByID($bugID);
|
||||
|
||||
@@ -556,15 +556,9 @@ class bug extends control
|
||||
|
||||
/* 如果 bug 转任务,删除 bug 时确认是否更新任务状态。*/
|
||||
/* If the bug has been transfered to a task, confirm to update task when delete the bug. */
|
||||
if($bug->toTask)
|
||||
{
|
||||
$result = $this->bugZen->confirm2UpdateTask($bugID, $bug->toTask);
|
||||
if(is_array($result)) return $this->send($result);
|
||||
}
|
||||
if($bug->toTask) $this->bugZen->confirm2UpdateTask($bugID, $bug->toTask);
|
||||
|
||||
$this->executeHooks($bugID);
|
||||
|
||||
return $this->send($this->bugZen->responseAfterDelete($bug, $from));
|
||||
return $this->bugZen->responseAfterDelete($bug, $from);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+8
-5
@@ -1321,7 +1321,7 @@ class bugZen extends bug
|
||||
$confirmedURL = $this->createLink('task', 'view', "taskID=$taskID");
|
||||
unset($_GET['onlybody']);
|
||||
$canceledURL = $this->createLink('bug', 'view', "bugID=$bugID");
|
||||
return array('result' => 'success', 'load' => array('confirm' => $this->lang->bug->remindTask, 'confirmed' => $confirmedURL, 'canceled' => $canceledURL));
|
||||
return $this->send(array('result' => 'success', 'load' => array('confirm' => $this->lang->bug->remindTask, 'confirmed' => $confirmedURL, 'canceled' => $canceledURL)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1335,11 +1335,14 @@ class bugZen extends bug
|
||||
*/
|
||||
protected function responseAfterDelete(object $bug, string $from): array
|
||||
{
|
||||
if($this->viewType == 'json') return array('result' => 'success', 'message' => $this->lang->saveSuccess);
|
||||
$message = $this->executeHooks($bugID);
|
||||
if(!$message) $message = $this->lang->saveSuccess;
|
||||
|
||||
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $message));
|
||||
|
||||
/* 在弹窗中删除 bug 时的返回。*/
|
||||
/* Respond when delete bug in modal.。*/
|
||||
if(isonlybody()) return array('result' => 'success', 'load' => true);
|
||||
if(isonlybody()) return $this->send(array('result' => 'success', 'load' => true));
|
||||
|
||||
/* 在任务看板中删除 bug 时的返回。*/
|
||||
/* Respond when delete in task kanban. */
|
||||
@@ -1352,10 +1355,10 @@ class bugZen extends bug
|
||||
$kanbanType = $laneType == 'all' ? 'bug' : key($kanbanData);
|
||||
$kanbanData = json_encode($kanbanData[$kanbanType]);
|
||||
|
||||
return array('result' => 'success', 'closeModal' => true, 'callback' => "updateKanban(\"bug\", $kanbanData)");
|
||||
return $this->send(array('result' => 'success', 'closeModal' => true, 'callback' => "updateKanban(\"bug\", $kanbanData)"));
|
||||
}
|
||||
|
||||
return array('result' => 'success', 'load' => $this->session->bugList ?: inlink('browse', "productID={$bug->product}"));
|
||||
return $this->send(array('result' => 'success', 'message' => $message, 'load' => $this->session->bugList ? $this->session->bugList : inlink('browse', "productID={$bug->product}")));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user