mirror of
https://github.com/nextcloud/tables.git
synced 2025-07-22 18:28:09 +00:00
fix: Properly display teams in usergroup
Signed-off-by: Cleopatra Enjeck M. <patrathewhiz@gmail.com>
This commit is contained in:

committed by
Enjeck

parent
b12c22d4fe
commit
fca79c7352
14
lib/Constants/UsergroupType.php
Normal file
14
lib/Constants/UsergroupType.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\Tables\Constants;
|
||||
|
||||
class UsergroupType {
|
||||
public const USER = 0;
|
||||
public const GROUP = 1;
|
||||
public const CIRCLE = 2;
|
||||
}
|
@ -7,8 +7,11 @@
|
||||
|
||||
namespace OCA\Tables\Db;
|
||||
|
||||
use OCA\Tables\Constants\UsergroupType;
|
||||
use OCA\Tables\Helper\CircleHelper;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUserSession;
|
||||
|
||||
/** @template-extends RowCellMapperSuper<RowCellUsergroup, array, array> */
|
||||
class RowCellUsergroupMapper extends RowCellMapperSuper {
|
||||
@ -17,6 +20,8 @@ class RowCellUsergroupMapper extends RowCellMapperSuper {
|
||||
public function __construct(
|
||||
IDBConnection $db,
|
||||
private IUserManager $userManager,
|
||||
private CircleHelper $circleHelper,
|
||||
protected IUserSession $userSession,
|
||||
) {
|
||||
parent::__construct($db, $this->table, RowCellUsergroup::class);
|
||||
}
|
||||
@ -34,7 +39,12 @@ class RowCellUsergroupMapper extends RowCellMapperSuper {
|
||||
}
|
||||
|
||||
public function formatEntity(Column $column, RowCellSuper $cell) {
|
||||
$displayName = $cell->getValueType() === 0 ? ($this->userManager->getDisplayName($cell->getValue()) ?? $cell->getValue()) : $cell->getValue();
|
||||
$displayName = $cell->getValue();
|
||||
if ($cell->getValueType() === UsergroupType::USER) {
|
||||
$displayName = $this->userManager->getDisplayName($cell->getValue()) ?? $cell->getValue();
|
||||
} elseif ($cell->getValueType() === UsergroupType::CIRCLE) {
|
||||
$displayName = $this->circleHelper->getCircleDisplayName($cell->getValue(), $this->userSession->getUser()->getUID() ?? '') ?? $cell->getValue();
|
||||
}
|
||||
return [
|
||||
'id' => $cell->getValue(),
|
||||
'type' => $cell->getValueType(),
|
||||
|
Reference in New Issue
Block a user