fix(team-manager): team is already teamid

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
This commit is contained in:
Maxence Lange 2025-11-24 16:02:51 -01:00 committed by backportbot[bot]
parent 879cf62fa5
commit ae250d08f0
3 changed files with 4 additions and 4 deletions

View file

@ -65,8 +65,8 @@ class TeamsApiController extends \OCP\AppFramework\OCSController {
public function listTeams(string $providerId, string $resourceId): DataResponse {
/** @psalm-suppress PossiblyNullArgument The route is limited to logged-in users */
$teams = $this->teamManager->getTeamsForResource($providerId, $resourceId, $this->userId);
$sharesPerTeams = $this->teamManager->getSharedWithList(array_map(fn (Team $team): string => $team->getId(), $teams), $this->userId);
$listTeams = array_values(array_map(function (Team $team) use ($sharesPerTeams) {
$sharesPerTeams = $this->teamManager->getSharedWithList(array_map(static fn (Team $team): string => $team->getId(), $teams), $this->userId);
$listTeams = array_values(array_map(static function (Team $team) use ($sharesPerTeams) {
$response = $team->jsonSerialize();
/** @psalm-suppress PossiblyNullArgument The route is limited to logged in users */
$response['resources'] = array_map(static fn (TeamResource $resource) => $resource->jsonSerialize(), $sharesPerTeams[$team->getId()] ?? []);

View file

@ -94,7 +94,7 @@ class TeamManager implements ITeamManager {
$resources[] = $provider->getSharedWithList($teams, $userId);
} else {
foreach ($teams as $team) {
$resources[] = [$team->getId() => $provider->getSharedWith($team->getId())];
$resources[] = [$team => $provider->getSharedWith($team)];
}
}
}

View file

@ -41,7 +41,7 @@ interface ITeamManager {
public function getTeamsForResource(string $providerId, string $resourceId, string $userId): array;
/**
* @param list<Team> $teams
* @param string[] $teams
* @return array<string, list<TeamResource>>
*
* @since 31.0.11