Skip to content

Commit 716c5e0

Browse files
Merge pull request #40511 from nextcloud/fix/dashboard-widgets-api
Fix dashboard widgets api
2 parents 9a70c1e + 6c84098 commit 716c5e0

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

apps/dashboard/lib/Controller/DashboardApiController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function getWidgetItemsV2(array $sinceIds = [], int $limit = 7, array $wi
150150
* @NoAdminRequired
151151
* @NoCSRFRequired
152152
*
153-
* @return DataResponse<Http::STATUS_OK, DashboardWidget[], array{}>
153+
* @return DataResponse<Http::STATUS_OK, array<string, DashboardWidget>, array{}>
154154
*/
155155
public function getWidgets(): DataResponse {
156156
$widgets = $this->dashboardManager->getWidgets();

apps/dashboard/openapi.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@
220220
"$ref": "#/components/schemas/OCSMeta"
221221
},
222222
"data": {
223-
"type": "array",
224-
"items": {
223+
"type": "object",
224+
"additionalProperties": {
225225
"$ref": "#/components/schemas/Widget"
226226
}
227227
}

lib/private/Dashboard/Manager.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class Manager implements IManager {
4040
/** @var array */
4141
private $lazyWidgets = [];
4242

43-
/** @var IWidget[] */
44-
private $widgets = [];
43+
/** @var array<string, IWidget> */
44+
private array $widgets = [];
4545

4646
private ContainerInterface $serverContainer;
4747
private ?IAppManager $appManager = null;
@@ -134,6 +134,9 @@ public function loadLazyPanels(): void {
134134
$this->lazyWidgets = [];
135135
}
136136

137+
/**
138+
* @return array<string, IWidget>
139+
*/
137140
public function getWidgets(): array {
138141
$this->loadLazyPanels();
139142
return $this->widgets;

lib/public/Dashboard/IManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function lazyRegisterWidget(string $widgetClass, string $appId): void;
4040
/**
4141
* @since 20.0.0
4242
*
43-
* @return IWidget[]
43+
* @return array<string, IWidget>
4444
*/
4545
public function getWidgets(): array;
4646
}

0 commit comments

Comments
 (0)