* Fix bug#21498

This commit is contained in:
zenggang
2022-04-28 09:53:39 +00:00
parent 1d9f9c0e75
commit 073b30159c
2 changed files with 6 additions and 3 deletions

View File

@@ -133,7 +133,7 @@ class gitModel extends model
{
$gitlabUserList = $this->loadModel('gitlab')->apiGetUsers($repo->gitlab);
$acountIDPairs = $this->gitlab->getUserIdAccountPairs($repo->gitlab);
foreach($gitlabUserList as $gitlabUser) $gitlabAccountPairs[$gitlabUser->realname] = zget($acountIDPairs, $gitlabUser->id, $gitlabUser->realname);
foreach($gitlabUserList as $gitlabUser) $gitlabAccountPairs[$gitlabUser->realname] = zget($acountIDPairs, $gitlabUser->id, '');
}
/* Update code commit history. */

View File

@@ -1568,12 +1568,15 @@ class repoModel extends model
*/
public function saveAction2PMS($objects, $log, $repoRoot = '', $encodings = 'utf-8', $scm = 'svn', $gitlabAccountPairs = array())
{
if(empty($gitlabAccountPairs))
if(isset($gitlabAccountPairs[$log->author]) and $gitlabAccountPairs[$log->author])
{
$log->author = $gitlabAccountPairs[$log->author];
}
else
{
$commiters = $this->loadModel('user')->getCommiters('account');
$log->author = zget($commiters, $log->author);
}
$log->author = isset($gitlabAccountPairs[$log->author]) ? $gitlabAccountPairs[$log->author] : $log->author;
if(isset($this->app->user))
{