]> source.dussan.org Git - nextcloud-server.git/commitdiff
refs #22468 fix empty php array becoming an array instead of an object in UI 22531/head
authorJulien Veyssier <eneiluj@posteo.net>
Mon, 31 Aug 2020 15:44:30 +0000 (17:44 +0200)
committerJulien Veyssier <eneiluj@posteo.net>
Fri, 4 Sep 2020 16:19:46 +0000 (18:19 +0200)
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
apps/dashboard/lib/Controller/DashboardController.php

index c9fd96fcb6f74c12c5e224b5d99aa45fa75af830..57717b26698431036be3a46f02ae1d13e7658081 100644 (file)
@@ -103,8 +103,12 @@ class DashboardController extends Controller {
                                'url' => $widget->getUrl()
                        ];
                }, $this->dashboardManager->getWidgets());
-               $configStatuses = $this->config->getUserValue($this->userId, 'dashboard', 'statuses', '{}');
+               $configStatuses = $this->config->getUserValue($this->userId, 'dashboard', 'statuses', '');
                $statuses = json_decode($configStatuses, true);
+               // We avoid getting an empty array as it will not produce an object in UI's JS
+               // It does not matter if some statuses are missing from the array, missing ones are considered enabled
+               $statuses = ($statuses && count($statuses) > 0) ? $statuses : ['weather' => true];
+
                $this->inititalStateService->provideInitialState('dashboard', 'panels', $widgets);
                $this->inititalStateService->provideInitialState('dashboard', 'statuses', $statuses);
                $this->inititalStateService->provideInitialState('dashboard', 'layout', $userLayout);