diff options
author | Julien Veyssier <eneiluj@posteo.net> | 2020-08-31 17:44:30 +0200 |
---|---|---|
committer | Julien Veyssier <eneiluj@posteo.net> | 2020-09-04 18:19:46 +0200 |
commit | e8f37dd2b2588e4fd21cab577cdd42dce64a36d7 (patch) | |
tree | 422beb33dd1150a936c8a97cc06902b98d253ae4 /apps/dashboard | |
parent | 3c62767873c4bf5d0770bf3af2129f50cbdcfe2f (diff) | |
download | nextcloud-server-e8f37dd2b2588e4fd21cab577cdd42dce64a36d7.tar.gz nextcloud-server-e8f37dd2b2588e4fd21cab577cdd42dce64a36d7.zip |
refs #22468 fix empty php array becoming an array instead of an object in UI
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Diffstat (limited to 'apps/dashboard')
-rw-r--r-- | apps/dashboard/lib/Controller/DashboardController.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/dashboard/lib/Controller/DashboardController.php b/apps/dashboard/lib/Controller/DashboardController.php index c9fd96fcb6f..57717b26698 100644 --- a/apps/dashboard/lib/Controller/DashboardController.php +++ b/apps/dashboard/lib/Controller/DashboardController.php @@ -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); |