diff --git a/lib/Group/GroupBackend.php b/lib/Group/GroupBackend.php index 469887630..68d09c2b6 100644 --- a/lib/Group/GroupBackend.php +++ b/lib/Group/GroupBackend.php @@ -126,7 +126,7 @@ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { return []; } - $groups = $this->connectedGroups->getConnectedGroupsToSpace($gid); + $groups = $this->connectedGroups->getConnectedGroupsToSpaceGroup($gid); if ($groups === null) { return []; } diff --git a/lib/Service/Group/ConnectedGroupsService.php b/lib/Service/Group/ConnectedGroupsService.php index e45f83bf1..b79762a6d 100644 --- a/lib/Service/Group/ConnectedGroupsService.php +++ b/lib/Service/Group/ConnectedGroupsService.php @@ -81,7 +81,7 @@ public function getConnectedSpaceToGroupIds(string $gid): ?array { * @param string $spaceGid * @return array|null */ - public function getConnectedGroupsToSpace(string $spaceGid): ?array { + public function getConnectedGroupsToSpaceGroup(string $spaceGid): ?array { if (!isset(self::$LINKED_SPACE_GROUPS[$spaceGid])) { return null; } @@ -96,7 +96,7 @@ public function getConnectedGroupsToSpace(string $spaceGid): ?array { * @param string $gid * @return bool */ - public function hasConnectedgroups(string $gid) : bool { + public function hasConnectedGroups(string $gid) : bool { return isset(self::$LINKED_SPACE_GROUPS[$gid]); } } diff --git a/lib/Service/WorkspaceService.php b/lib/Service/WorkspaceService.php index 990bc912a..39451e94b 100644 --- a/lib/Service/WorkspaceService.php +++ b/lib/Service/WorkspaceService.php @@ -26,6 +26,7 @@ namespace OCA\Workspace\Service; use OCA\Workspace\Db\SpaceMapper; +use OCA\Workspace\Service\Group\ConnectedGroupsService; use OCA\Workspace\Service\Group\GroupFormatter; use OCA\Workspace\Service\Group\UserGroup; use OCA\Workspace\Service\Group\WorkspaceManagerGroup; @@ -47,7 +48,8 @@ public function __construct( private SpaceMapper $spaceMapper, private UserService $userService, private ShareMembersOnlyFilter $shareMembersFilter, - private GroupMembersOnlyChecker $memberGroupOnlyChecker + private GroupMembersOnlyChecker $memberGroupOnlyChecker, + private ConnectedGroupsService $connectedGroups, ) { } @@ -194,12 +196,23 @@ public function addUsersInfo(string|array $workspace): \stdClass { * */ public function addGroupsInfo(array|string $workspace): array { + if (!isset($workspace['groups'])) { + return $workspace; + } $groups = array_map( - fn($gid) => $this->groupManager->get($gid), - array_keys($workspace['groups']) - ); + fn($gid) => $this->groupManager->get($gid), + array_keys($workspace['groups']) + ); + $addedGroups = []; + foreach(array_keys($workspace['groups']) as $gid) { + $addedToGroup = $this->connectedGroups->getConnectedGroupsToSpaceGroup($gid); + if ($addedToGroup !== null) { + $addedGroups = array_merge($addedGroups, $addedToGroup); + } + } $workspace['groups'] = GroupFormatter::formatGroups($groups); + $workspace['addedGroups'] = GroupFormatter::formatGroups($addedGroups); return $workspace; } diff --git a/src/GroupDetails.vue b/src/GroupDetails.vue index ee6ed4f0a..dac7a162a 100644 --- a/src/GroupDetails.vue +++ b/src/GroupDetails.vue @@ -29,7 +29,7 @@ {{ $store.getters.groupName($route.params.space, $route.params.group) }} -