Skip to content

Commit

Permalink
refs #22468 fix empty php array becoming an array instead of an objec…
Browse files Browse the repository at this point in the history
…t in UI

Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
  • Loading branch information
Julien Veyssier committed Aug 31, 2020
1 parent 6b9b88f commit 4f79561
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/dashboard/lib/Controller/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,11 @@ public function index(): TemplateResponse {
'url' => $widget->getUrl()
];
}, $this->dashboardManager->getWidgets());
$configStatuses = $this->config->getUserValue($this->userId, 'dashboard', 'statuses', '{}');
// we avoid getting an empty array as it will not produce an object in UI
$configStatuses = $this->config->getUserValue($this->userId, 'dashboard', 'statuses', '{"weather": true}');
$statuses = json_decode($configStatuses, true);
$statuses = $statuses ? $statuses : ['weather' => true];

$this->inititalStateService->provideInitialState('dashboard', 'panels', $widgets);
$this->inititalStateService->provideInitialState('dashboard', 'statuses', $statuses);
$this->inititalStateService->provideInitialState('dashboard', 'layout', $userLayout);
Expand Down

0 comments on commit 4f79561

Please sign in to comment.