summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2020-09-04 21:24:52 +0200
committerGitHub <noreply@github.com>2020-09-04 21:24:52 +0200
commit0ed8d1c2bc50d2eca84ed615e9aa5a9ac749b7f4 (patch)
treea112055474545ba89390464fa67e86f944eb6bc0
parentc538b1e4c684bfd8782cbc6a1863212a33494b68 (diff)
parente8f37dd2b2588e4fd21cab577cdd42dce64a36d7 (diff)
downloadnextcloud-server-0ed8d1c2bc50d2eca84ed615e9aa5a9ac749b7f4.tar.gz
nextcloud-server-0ed8d1c2bc50d2eca84ed615e9aa5a9ac749b7f4.zip
Merge pull request #22531 from nextcloud/fix/save-statuses
Fix dashboard statuses toggling
-rw-r--r--apps/dashboard/lib/Controller/DashboardController.php6
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);