Skip to content

Commit

Permalink
fix: Fix navigation manager to be in line with server
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and provokateurin committed Oct 1, 2024
1 parent 0532e63 commit ff69bf3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
19 changes: 19 additions & 0 deletions lib/FilteredNavigationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,23 @@ public function setActiveEntry($appId): void {
public function setUnreadCounter(string $id, int $unreadCounter): void {
$this->navigationManager->setUnreadCounter($id, $unreadCounter);
}

public function get(string $id): ?array {
return $this->navigationManager->get($id);
}

public function getDefaultEntryIdForUser(?IUser $user = null, bool $withFallbacks = true): string {
return $this->navigationManager->getDefaultEntryIdForUser($user, $withFallbacks);
}

public function getDefaultEntryIds(bool $withFallbacks = true): array {
return $this->navigationManager->getDefaultEntryIds($withFallbacks);
}

/**
* @psalm-suppress MethodSignatureMismatch
*/
public function setDefaultEntryIds(array $ids): void {
$this->navigationManager->setDefaultEntryIds($ids);
}
}
2 changes: 1 addition & 1 deletion lib/RestrictionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function setupRestrictions(): void {
}

/** @var NavigationManager $navManager */
$navManager = $this->server->getNavigationManager();
$navManager = \OCP\Server::get(INavigationManager::class);

$this->server->registerService(INavigationManager::class, function () use ($navManager) {
return new FilteredNavigationManager($this->userSession->getUser(), $navManager, $this->whitelist);
Expand Down
12 changes: 12 additions & 0 deletions tests/stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@ public function getAll(string $type = self::TYPE_APPS): array {
*/
public function setUnreadCounter(string $id, int $unreadCounter): void {
}

public function get(string $id): ?array {
}

public function getDefaultEntryIdForUser(?\OCP\IUser $user = null, bool $withFallbacks = true): string {
}

public function getDefaultEntryIds(bool $withFallbacks = true): array {
}

public function setDefaultEntryIds(array $ids): void {
}
}

class AppConfig {
Expand Down

0 comments on commit ff69bf3

Please sign in to comment.