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. *