support multiple teamleads in each team (#2702)

* fix jumping avatars
* fix line-break after color dot for long names
This commit is contained in:
Kevin Papst
2021-08-07 18:05:41 +02:00
committed by GitHub
parent e9986c92d6
commit b2d3272151
101 changed files with 1952 additions and 649 deletions

View File

@@ -195,7 +195,7 @@ class ImportProjectCommand extends Command
$team = new Team();
$team->setName($project->getName());
$team->setTeamLead($teamlead);
$team->addTeamlead($teamlead);
$this->teams->saveTeam($team);

View File

@@ -1873,20 +1873,20 @@ final class KimaiImporterCommand extends Command
$team->addUser($user);
// first user in the team will become team lead
if ($team->getTeamLead() == null) {
$team->setTeamLead($user);
if (!$team->hasTeamleads()) {
$team->addTeamlead($user);
}
// any other user with admin role in the team will become team lead
// should be the last added admin of the source group
if ($row['membershipRoleID'] === 1) {
$team->setTeamLead($user);
$team->addTeamlead($user);
}
}
// if team has no users it will not be persisted
foreach ($newTeams as $oldId => $team) {
if ($team->getTeamLead() === null) {
if (!$team->hasUsers()) {
$io->warning(sprintf('Didn\'t import team: %s because it has no users.', $team->getName()));
++$skippedEmpty;
unset($newTeams[$oldId]);
@@ -1998,7 +1998,7 @@ final class KimaiImporterCommand extends Command
$team->setName($name);
$teamlead = $users[array_key_first($users)];
$teamlead = $this->getCachedUser($teamlead['userID']);
$team->setTeamLead($teamlead);
$team->addTeamlead($teamlead);
foreach ($users as $oldUser) {
$team->addUser($this->getCachedUser($oldUser['userID']));
foreach ($activities as $oldActivity) {

View File

@@ -128,7 +128,7 @@ class ResetTestCommand extends AbstractResetCommand
$team = new Team();
$team->setName('Test team');
$team->setTeamLead($userEntities[6]);
$team->addTeamlead($userEntities[6]);
$team->addUser($userEntities[7]);
$this->entityManager->persist($team);