Skip to content
Merged
Changes from all commits
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
13 changes: 10 additions & 3 deletions lib/private/NavigationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class NavigationManager implements INavigationManager {
/** @var IConfig */
private $config;
/** User defined app order (cached for the `add` function) */
private array $customAppOrder;
private ?array $customAppOrder = null;
private LoggerInterface $logger;

public function __construct(
Expand Down Expand Up @@ -209,6 +209,15 @@ public function getActiveEntry() {
}

private function init(bool $resolveClosures = true): void {
if ($this->customAppOrder === null) {
if ($this->userSession->isLoggedIn()) {
$user = $this->userSession->getUser();
$this->customAppOrder = json_decode($this->config->getUserValue($user->getUID(), 'core', 'apporder', '[]'), true, flags:JSON_THROW_ON_ERROR);
} else {
$this->customAppOrder = [];
}
}

if ($resolveClosures) {
while ($c = array_pop($this->closureEntries)) {
$this->add($c());
Expand Down Expand Up @@ -329,10 +338,8 @@ private function init(bool $resolveClosures = true): void {
if ($this->userSession->isLoggedIn()) {
$user = $this->userSession->getUser();
$apps = $this->appManager->getEnabledAppsForUser($user);
$this->customAppOrder = json_decode($this->config->getUserValue($user->getUID(), 'core', 'apporder', '[]'), true, flags:JSON_THROW_ON_ERROR);
} else {
$apps = $this->appManager->getEnabledApps();
$this->customAppOrder = [];
}

foreach ($apps as $app) {
Expand Down
Loading