* Adjust codes.

This commit is contained in:
caoyanyi
2022-07-20 09:06:31 +08:00
parent 07465a327d
commit 1b6f3e6a23
3 changed files with 9 additions and 23 deletions
+4 -2
View File
@@ -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
*/
+1 -19
View File
@@ -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();
+4 -2
View File
@@ -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);