From 43b0f1ceeb2e87ea426bd923770d287b15d19fd0 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Wed, 22 May 2024 16:20:34 +0200 Subject: [PATCH 1/3] fix(INavigationManager): Fix psalm alias not set in the right place Signed-off-by: provokateurin --- lib/public/INavigationManager.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/public/INavigationManager.php b/lib/public/INavigationManager.php index 36f80c3293f1e..d1e5e674ab0be 100644 --- a/lib/public/INavigationManager.php +++ b/lib/public/INavigationManager.php @@ -32,13 +32,11 @@ namespace OCP; -/** - * @psalm-type NavigationEntry = array{id: string, order: int, href: string, name: string, app?: string, icon?: string, classes?: string, type?: string} - */ - /** * Manages the ownCloud navigation * @since 6.0.0 + * + * @psalm-type NavigationEntry = array{id: string, order: int, href: string, name: string, app?: string, icon?: string, classes?: string, type?: string} */ interface INavigationManager { /** From d96f8e0ab2b4b5bbb4e1951922a9e19e6f380684 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Thu, 30 May 2024 16:59:04 +0200 Subject: [PATCH 2/3] fix(NavigationManager): Make entry order always an integer Signed-off-by: provokateurin --- core/ResponseDefinitions.php | 2 +- core/openapi.json | 11 ++--------- lib/private/NavigationManager.php | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/core/ResponseDefinitions.php b/core/ResponseDefinitions.php index b8f73bcdcdacd..eba1ca0fcd748 100644 --- a/core/ResponseDefinitions.php +++ b/core/ResponseDefinitions.php @@ -43,7 +43,7 @@ * * @psalm-type CoreNavigationEntry = array{ * id: string, - * order: int|string, + * order: int, * href: string, * icon: string, * type: string, diff --git a/core/openapi.json b/core/openapi.json index f3cc89b9216ee..fbdc709246216 100644 --- a/core/openapi.json +++ b/core/openapi.json @@ -196,15 +196,8 @@ "type": "string" }, "order": { - "oneOf": [ - { - "type": "integer", - "format": "int64" - }, - { - "type": "string" - } - ] + "type": "integer", + "format": "int64" }, "href": { "type": "string" diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php index 17573d9db86da..6808ab04c2c94 100644 --- a/lib/private/NavigationManager.php +++ b/lib/private/NavigationManager.php @@ -118,7 +118,7 @@ public function add($entry) { // This is the default app that will always be shown first $entry['default'] = ($entry['app'] ?? false) === $this->defaultApp; // Set order from user defined app order - $entry['order'] = $this->customAppOrder[$id]['order'] ?? $entry['order'] ?? 100; + $entry['order'] = (int)($this->customAppOrder[$id]['order'] ?? $entry['order'] ?? 100); } $this->entries[$id] = $entry; From bba54b55564dbf36c6602d6ebb4a7fe186f376c4 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Wed, 22 May 2024 16:21:12 +0200 Subject: [PATCH 3/3] fix(core): Fix NavigationEntry typing Signed-off-by: provokateurin --- core/ResponseDefinitions.php | 4 +++- core/openapi.json | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/ResponseDefinitions.php b/core/ResponseDefinitions.php index eba1ca0fcd748..3a84ed60a4b72 100644 --- a/core/ResponseDefinitions.php +++ b/core/ResponseDefinitions.php @@ -43,11 +43,13 @@ * * @psalm-type CoreNavigationEntry = array{ * id: string, - * order: int, + * order?: int, * href: string, * icon: string, * type: string, * name: string, + * app?: string, + * default?: bool, * active: bool, * classes: string, * unread: int, diff --git a/core/openapi.json b/core/openapi.json index fbdc709246216..eac918e4db97a 100644 --- a/core/openapi.json +++ b/core/openapi.json @@ -182,7 +182,6 @@ "type": "object", "required": [ "id", - "order", "href", "icon", "type", @@ -211,6 +210,12 @@ "name": { "type": "string" }, + "app": { + "type": "string" + }, + "default": { + "type": "boolean" + }, "active": { "type": "boolean" },