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 committed Sep 30, 2024
1 parent c601f87 commit 3825770
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
16 changes: 16 additions & 0 deletions lib/FilteredNavigationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,20 @@ 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);
}

public function setDefaultEntryIds(array $ids): void {

Check failure on line 85 in lib/FilteredNavigationManager.php

View workflow job for this annotation

GitHub Actions / Nextcloud dev-master

MethodSignatureMismatch

lib/FilteredNavigationManager.php:85:43: MethodSignatureMismatch: Argument 1 of OCA\Guests\FilteredNavigationManager::setDefaultEntryIds has wrong type 'array<array-key, mixed>', expecting 'array<array-key, string>' as defined by OCP\INavigationManager::setDefaultEntryIds (see https://psalm.dev/042)
$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 3825770

Please sign in to comment.