Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
address reviews
Signed-off-by: szaimen <[email protected]>
Signed-off-by: nextcloud-command <[email protected]>
  • Loading branch information
szaimen committed Mar 28, 2022
commit 5d01de8a101a764144b28ec997f6d41d54bb38f3
4 changes: 2 additions & 2 deletions apps/updatenotification/js/updatenotification.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/updatenotification/js/updatenotification.js.map

Large diffs are not rendered by default.

18 changes: 3 additions & 15 deletions apps/updatenotification/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ private function isWebUpdaterRecommended(): bool {
return $this->getUserCount() < 100;
}

// Copied from https://github.com/nextcloud/server/blob/a06001e0851abc6073af678b742da3e1aa96eec9/lib/private/Support/Subscription/Registry.php#L187-L214
/**
* @see https://github.com/nextcloud/server/blob/39494fbf794d982f6f6551c984e6ca4c4e947d01/lib/private/Support/Subscription/Registry.php#L188-L216 implementation reference
*/
private function getUserCount(): int {
$userCount = 0;
$backends = $this->userManager->getBackends();
Expand All @@ -213,24 +215,10 @@ private function getUserCount(): int {
$backendUsers = $backend->countUsers();
if ($backendUsers !== false) {
$userCount += $backendUsers;
} else {
// TODO what if the user count can't be determined?
$this->logger->warning('Can not determine user count for ' . get_class($backend), ['app' => 'updatenotification']);
}
}
}

$disabledUsers = $this->config->getUsersForUserValue('core', 'enabled', 'false');
$disabledUsersCount = count($disabledUsers);
$userCount = $userCount - $disabledUsersCount;

if ($userCount < 0) {
$userCount = 0;

// this should never happen
$this->logger->warning("Total user count was negative (users: $userCount, disabled: $disabledUsersCount)", ['app' => 'updatenotification']);
}

return $userCount;
}
}