From 5657d5753b2680205f6eb0824c6da4dbf372e0b5 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Tue, 10 Oct 2023 09:26:12 +0800 Subject: [PATCH] * Fix bug #32934. --- module/mr/model.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/mr/model.php b/module/mr/model.php index c5f2fca2f1..a26446de82 100644 --- a/module/mr/model.php +++ b/module/mr/model.php @@ -762,11 +762,12 @@ class mrModel extends model } $response = json_decode(commonModel::http($url, $data = null, $options = array(), $headers = array(), $dataType = 'data', $method = 'POST', $timeout = 30, $httpCode = false, $log = false)); - if(empty($response)) $response = array(); + if(empty($response) || isset($response->message)) $response = array(); if($scm == 'Gitea') { foreach($response as $MR) { + if(empty($MR)) continue; $MR->iid = $MR->number; $MR->state = $MR->state == 'open' ? 'opened' : $MR->state; if($MR->merged) $MR->state = 'merged'; @@ -946,11 +947,11 @@ class mrModel extends model $newMR->squash = $MR->squash == '1' ? 1 : 0; if($MR->assignee) { - $gitlabAssignee = $this->gitlab->getUserIDByZentaoAccount($MR->hostID, $MR->assignee); + $gitlabAssignee = $this->gitlab->getUserIDByZentaoAccount($hostID, $MR->assignee); if($gitlabAssignee) $newMR->assignee_ids = $gitlabAssignee; } $url = sprintf($this->gitlab->getApiRoot($hostID), "/projects/$projectID/merge_requests/$MRID"); - return json_decode(commonModel::http($url, $MR, $options = array(CURLOPT_CUSTOMREQUEST => 'PUT'))); + return json_decode(commonModel::http($url, $newMR, $options = array(CURLOPT_CUSTOMREQUEST => 'PUT'))); } else { @@ -963,7 +964,6 @@ class mrModel extends model $assignee = $this->{$host->type}->getUserIDByZentaoAccount($this->post->hostID, $MR->assignee); if($assignee) $newMR->assignee = $assignee; } - $mergeResult = json_decode(commonModel::http($url, $newMR, array(), array(), 'json', 'PATCH')); if(isset($mergeResult->number)) $mergeResult->iid = $host->type == 'gitea' ? $mergeResult->number : $mergeResult->id; if(isset($mergeResult->mergeable))