From b2f1fd3f3cdba385403bf8ddd3f7005387d4838a Mon Sep 17 00:00:00 2001 From: dingguodong Date: Tue, 31 Aug 2021 11:05:03 +0800 Subject: [PATCH] + Accept a MR. --- module/mr/control.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/module/mr/control.php b/module/mr/control.php index 5acb340fa0..a3f9ee28fb 100644 --- a/module/mr/control.php +++ b/module/mr/control.php @@ -132,6 +132,7 @@ class mr extends control } /** +<<<<<<< HEAD * Crontab sync MR from GitLab API to Zentao database, default time 5 minutes to execute once. * * @access public @@ -150,6 +151,20 @@ class mr extends control echo 'success'; } + /** Accept a MR. + * + * @param int $MRID + * @access public + * @return void + */ + public function accept($MRID) + { + $MR = $this->mr->getByID($MRID); + if(isset($MR->gitlabID)) $rawMR = $this->mr->apiAcceptMR($MR->gitlabID, $MR->targetProject, $MR->mriid); + if(isset($rawMR->state) and $rawMR->state == 'merged') return array('result' => 'success', 'message' => $this->lang->mr->mergeSuccess); + return array('result' => 'fail', 'message' => $this->lang->mr->mergeFailed); + } + /** * AJAX: Get MR target projects. *