* Finish task#44402

This commit is contained in:
zenggang
2021-11-19 08:19:21 +00:00
parent 15ce4de1e4
commit 7c6a0b0e4e
6 changed files with 35 additions and 16 deletions
+12 -12
View File
@@ -107,7 +107,7 @@ class mrModel extends model
}
/* Exec Job */
if(isset($MR->$jobID) && $MR->jobID)
if(isset($MR->jobID) && $MR->jobID)
{
$pipeline = $this->loadModel('job')->exec($MR->jobID);
if($pipeline->queue)
@@ -132,7 +132,11 @@ class mrModel extends model
$MRObject->target_branch = $MR->targetBranch;
$MRObject->title = $MR->title;
$MRObject->description = $MR->description;
$MRObject->assignee_ids = $MR->assignee;
if($MR->assignee)
{
$gitlabAssignee = $this->gitlab->getUserIDByZentaoAccount($this->post->gitlabID, $MR->assignee);
if($gitlabAssignee) $MRObject->assignee_ids = $gitlabAssignee;
}
$rawMR = $this->apiCreateMR($this->post->gitlabID, $this->post->sourceProject, $MRObject);
@@ -161,10 +165,6 @@ class mrModel extends model
$newMR->status = $rawMR->state;
$newMR->mergeStatus = $rawMR->merge_status;
/* Change gitlab user ID to zentao account. */
$gitlabUsers = $this->gitlab->getUserIdAccountPairs($MR->gitlabID);
$newMR->assignee = zget($gitlabUsers, $MR->assignee, '');
/* Update MR in Zentao database. */
$this->dao->update(TABLE_MR)->data($newMR)
->where('id')->eq($MRID)
@@ -204,7 +204,7 @@ class mrModel extends model
$oldMR = $this->getByID($MRID);
/* Exec Job */
if($MR->jobID)
if(isset($MR->jobID) && $MR->jobID)
{
$pipeline = $this->loadModel('job')->exec($MR->jobID);
@@ -220,16 +220,16 @@ class mrModel extends model
$newMR = new stdclass;
$newMR->title = $MR->title;
$newMR->description = $MR->description;
$newMR->assignee_ids = $MR->assignee;
$newMR->target_branch = $MR->targetBranch;
if($MR->assignee)
{
$gitlabAssignee = $this->gitlab->getUserIDByZentaoAccount($oldMR->gitlabID, $MR->assignee);
if($gitlabAssignee) $newMR->assignee_ids = $gitlabAssignee;
}
/* Known issue: `reviewer_ids` takes no effect. */
$rawMR = $this->apiUpdateMR($oldMR->gitlabID, $oldMR->targetProject, $oldMR->mriid, $newMR);
/* Change gitlab user ID to zentao account. */
$gitlabUsers = $this->gitlab->getUserIdAccountPairs($oldMR->gitlabID);
$MR->assignee = zget($gitlabUsers, $MR->assignee, '');
/* Update MR in Zentao database. */
$this->dao->update(TABLE_MR)->data($MR, $this->config->mr->edit->skippedFields)
->where('id')->eq($MRID)