Skip to content

Commit efa4ea1

Browse files
committed
fix(users): use correct active user count
Signed-off-by: Benjamin Gaussorgues <[email protected]>
1 parent c4ce15a commit efa4ea1

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

apps/settings/lib/Controller/UsersController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public function usersList(): TemplateResponse {
166166
$recentUsersGroup = [
167167
'id' => '__nc_internal_recent',
168168
'name' => $this->l10n->t('Recently active'),
169-
'usercount' => $userCount,
169+
'usercount' => $this->userManager->countSeenUsers(),
170170
];
171171

172172
$disabledUsersGroup = [

tests/lib/User/ManagerTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use OCP\ICacheFactory;
1717
use OCP\IConfig;
1818
use OCP\IUser;
19+
use OCP\IUserManager;
1920
use Psr\Log\LoggerInterface;
2021
use Test\TestCase;
2122

@@ -579,7 +580,7 @@ public function testCountUsersTwoBackends(): void {
579580
}
580581

581582
public function testCountUsersOnlyDisabled(): void {
582-
$manager = \OC::$server->getUserManager();
583+
$manager = \OCP\Server::get(IUserManager::class);
583584
// count other users in the db before adding our own
584585
$countBefore = $manager->countDisabledUsers();
585586

@@ -604,7 +605,7 @@ public function testCountUsersOnlyDisabled(): void {
604605
}
605606

606607
public function testCountUsersOnlySeen(): void {
607-
$manager = \OC::$server->getUserManager();
608+
$manager = \OCP\Server::get(IUserManager::class);
608609
// count other users in the db before adding our own
609610
$countBefore = $manager->countSeenUsers();
610611

@@ -630,7 +631,7 @@ public function testCountUsersOnlySeen(): void {
630631
}
631632

632633
public function testCallForSeenUsers(): void {
633-
$manager = \OC::$server->getUserManager();
634+
$manager = \OCP\Server::get(IUserManager::class);
634635
// count other users in the db before adding our own
635636
$count = 0;
636637
$function = function (IUser $user) use (&$count) {
@@ -664,7 +665,7 @@ public function testCallForSeenUsers(): void {
664665
}
665666

666667
public function testRecentlyActive(): void {
667-
$manager = \OC::$server->getUserManager();
668+
$manager = \OCP\Server::get(IUserManager::class);
668669
$config = \OC::$server->get(IConfig::class);
669670

670671
// Create some users

0 commit comments

Comments
 (0)