Skip to content

Commit

Permalink
refactor: Add is_connected and profile keys when formatting a user
Browse files Browse the repository at this point in the history
  • Loading branch information
zak39 committed Dec 16, 2024
1 parent 584eb51 commit f3c1be8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/Users/UserFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

namespace OCA\Workspace\Users;

use OCA\Workspace\Service\Group\ConnectedGroupsService;
use OCP\IGroupManager;
use OCP\IURLGenerator;
use OCP\IUser;

class UserFormatter {
public function __construct(private IGroupManager $groupManager) {
public function __construct(
private IGroupManager $groupManager,
private ConnectedGroupsService $connectedGroupsService,
private IURLGenerator $urlGenerator
) {
}

/**
Expand All @@ -32,6 +38,8 @@ public function formatUser(IUser $user, array $space, string $role): array {
'email' => $user->getEmailAddress(),
'subtitle' => $user->getEmailAddress(),
'groups' => $groups,
'is_connected' => $this->connectedGroupsService->isUserConnectedGroup($user->getUID()),
'profile' => $this->urlGenerator->linkToRouteAbsolute('core.ProfilePage.index', ['targetUserId' => $user->getUID()]),
'role' => $role
];
}
Expand Down

0 comments on commit f3c1be8

Please sign in to comment.