* Fix bug#50694,50689

This commit is contained in:
zenggang
2022-03-15 02:56:31 +00:00
parent 99924a75a5
commit 2431e1ccc2
3 changed files with 35 additions and 3 deletions

View File

@@ -166,7 +166,31 @@ class gitModel extends model
' task:' . join(' ', $objects['tasks']) .
' bug:' . join(',', $objects['bugs']));
$this->repo->saveAction2PMS($objects, $log, $this->repoRoot, $repo->encoding, 'git');
if($repo->SCM == 'Gitlab')
{
if(!isset($gitlabAccountPairs))
{
$gitlabAccountPairs = array();
$gitlabUserList = $this->loadModel('gitlab')->apiGetUsers($repo->gitlab);
$acountIDPairs = $this->gitlab->getUserIdAccountPairs($repo->gitlab);
foreach($acountIDPairs as $openID => $account)
{
foreach($gitlabUserList as $gitlabUser)
{
if($gitlabUser->id == $openID)
{
$gitlabAccountPairs[$gitlabUser->realname] = $account;
break;
}
}
}
}
$this->repo->saveAction2PMS($objects, $log, $this->repoRoot, $repo->encoding, 'git', $gitlabAccountPairs);
}
else
{
$this->repo->saveAction2PMS($objects, $log, $this->repoRoot, $repo->encoding, 'git');
}
}
else
{

View File

@@ -555,6 +555,9 @@ class mrModel extends model
->fetch();
if(empty($todoDesc))
{
$acountPairs = $this->gitlab->getUserIdRealnamePairs($gitlabID);
$author = isset($acountPairs[$rawTodo->author->id]) ? $acountPairs[$rawTodo->author->id] : $rawTodo->author->name;
$todo = new stdClass;
$todo->account = $this->app->user->account;
$todo->assignedTo = $account;
@@ -567,7 +570,7 @@ class mrModel extends model
$todo->idvalue = $rawTodo->id;
$todo->pri = 3;
$todo->name = $this->lang->mr->common . ": " . $rawTodo->target->title;
$todo->desc = $rawTodo->target->assignee->name . '&nbsp;' . $this->lang->mr->at . '&nbsp;' . '<a href="' . $this->gitlab->apiGetSingleProject($gitlabID, $projectID)->web_url . '" target="_blank">' . $rawTodo->project->path .'</a>' . '&nbsp;' . $this->lang->mr->todomessage . '<a href="' . $rawTodo->target->web_url . '" target="_blank">' . '&nbsp;' . $this->lang->mr->common .'</a>' . '。';
$todo->desc = $author . '&nbsp;' . $this->lang->mr->at . '&nbsp;' . '<a href="' . $this->gitlab->apiGetSingleProject($gitlabID, $projectID)->web_url . '" target="_blank">' . $rawTodo->project->path .'</a>' . '&nbsp;' . $this->lang->mr->todomessage . '<a href="' . $rawTodo->target->web_url . '" target="_blank">' . '&nbsp;' . $this->lang->mr->common .'</a>' . '。';
$todo->status = 'wait';
$todo->finishedBy = '';

View File

@@ -1533,11 +1533,16 @@ class repoModel extends model
* @param array $objects
* @param object $log
* @param string $repoRoot
* @param string $encodings
* @param string $scm
* @param array $gitlabAccountPairs
* @access public
* @return void
*/
public function saveAction2PMS($objects, $log, $repoRoot = '', $encodings = 'utf-8', $scm = 'svn')
public function saveAction2PMS($objects, $log, $repoRoot = '', $encodings = 'utf-8', $scm = 'svn', $gitlabAccountPairs = array())
{
$log->author = isset($gitlabAccountPairs[$log->author]) ? $gitlabAccountPairs[$log->author] : $log->author;
if(isset($this->app->user))
{
$account = $this->app->user->account;