diff --git a/module/mr/control.php b/module/mr/control.php index c0e5d013ca..8245ac4031 100644 --- a/module/mr/control.php +++ b/module/mr/control.php @@ -152,9 +152,10 @@ class mr extends control $this->view->rawMR = isset($rawMR) ? $rawMR : false; if(!isset($rawMR->id) or (isset($rawMR->message) and $rawMR->message == '404 Not found') or empty($rawMR)) return $this->display(); - $host = $this->loadModel('pipeline')->getByID($MR->hostID); - $scm = $host->type; + $host = $this->loadModel('pipeline')->getByID($MR->hostID); + $scm = $host->type; $branchList = $this->loadModel($scm)->getBranches($MR->hostID, $MR->targetProject); + $targetBranchList = array(); foreach($branchList as $branch) $targetBranchList[$branch] = $branch; @@ -891,6 +892,7 @@ class mr extends control * * @param int $hostID * @param int $projectID + * @param string $scm * @access public * @return void */ diff --git a/module/mr/js/create.js b/module/mr/js/create.js index 0a15f093f5..f4c4f75262 100644 --- a/module/mr/js/create.js +++ b/module/mr/js/create.js @@ -40,7 +40,7 @@ $(function() var hostID = $('#hostID').val(); var sourceProject = urlencode($(this).val()); var branchSelect = $(this).parents('td').find('select[name*=Branch]'); - var branchUrl = createLink(hosts[hostID].type, 'ajaxGetProjectBranches', "hostID=" + hostID + "&projectID=" + sourceProject); + var branchUrl = createLink(hosts[hostID].type, 'ajaxGetProjectBranches', hosts[hostID].type + "ID=" + hostID + "&projectID=" + sourceProject); $.get(branchUrl, function(response) { branchSelect.html('').append(response); @@ -91,24 +91,6 @@ $(function() }); }); - /* - $('#targetProject').change(function() - { - targetProject = $(this).val(); - var hostID = $('#hostID').val(); - var assignee = $("#assignee").parents('td').find('select[name*=assignee]'); - var reviewer = $("#reviewer").parents('td').find('select[name*=reviewer]'); - usersUrl = createLink('gitlab', 'ajaxgetmruserpairs', "hostID=" + hostID + "&projectID=" + targetProject); - $.get(usersUrl, function(response) - { - assignee.html('').append(response); - assignee.chosen().trigger("chosen:updated");; - reviewer.html('').append(response); - reviewer.chosen().trigger("chosen:updated");; - }); - }); - */ - $('#repoID').change(function() { var repoID = $(this).val(); diff --git a/module/mr/model.php b/module/mr/model.php index 661ecf6d57..c82ccae2a3 100644 --- a/module/mr/model.php +++ b/module/mr/model.php @@ -680,6 +680,7 @@ class mrModel extends model * @link https://docs.gitlab.com/ee/api/merge_requests.html#list-project-merge-requests * @param int $hostID * @param int $projectID + * @param string $scm * @access public * @return object */ @@ -974,8 +975,9 @@ class mrModel extends model elseif($host->type == 'gitea') { $apiRoot = $this->loadModel('gitea')->getApiRoot($hostID); - $url = sprintf($apiRoot, "/repos/$projectID/pulls/$MRID/merge"); - $rowMR = json_decode(commonModel::http($url, array('Do' => 'merge'), array(), array(), 'json', 'POST')); + $url = sprintf($apiRoot, "/repos/$projectID/pulls/$MRID/merge"); + $merege = ($MR and $MR->squash == '1') ? 'squash' : 'merge'; + $rowMR = json_decode(commonModel::http($url, array('Do' => $merge), array(), array(), 'json', 'POST')); if(!isset($rowMR->massage)) { $rowMR = $this->apiGetSingleMR($hostID, $projectID, $MRID);