Merge branch 'fix/docgen-accompanying-period-context-with-list-aworks' into 'master'

Refactor username mapping in activity context filter.

See merge request Chill-Projet/chill-bundles!797
This commit is contained in:
2025-02-14 12:20:07 +00:00
2 changed files with 10 additions and 1 deletions

View File

@@ -143,7 +143,10 @@ class ListActivitiesByAccompanyingPeriodContext implements
array_filter(
$works,
function ($work) use ($user) {
$workUsernames = array_map(static fn (User $user) => $user['username'], $work['referrers'] ?? []);
$workUsernames = [];
foreach ($work['referrers'] as $referrer) {
$workUsernames[] = $referrer['username'];
}
return \in_array($user->getUserIdentifier(), $workUsernames, true);
}