Skip to content

Commit

Permalink
fix(users): use correct active user count
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Gaussorgues <[email protected]>
  • Loading branch information
Altahrim committed Oct 8, 2024
1 parent c4ce15a commit efa4ea1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/settings/lib/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function usersList(): TemplateResponse {
$recentUsersGroup = [
'id' => '__nc_internal_recent',
'name' => $this->l10n->t('Recently active'),
'usercount' => $userCount,
'usercount' => $this->userManager->countSeenUsers(),
];

$disabledUsersGroup = [
Expand Down
9 changes: 5 additions & 4 deletions tests/lib/User/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IUser;
use OCP\IUserManager;
use Psr\Log\LoggerInterface;
use Test\TestCase;

Expand Down Expand Up @@ -579,7 +580,7 @@ public function testCountUsersTwoBackends(): void {
}

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

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

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

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

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

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

// Create some users
Expand Down

0 comments on commit efa4ea1

Please sign in to comment.