mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
refs #22468 fix empty php array becoming an array instead of an object in UI
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
This commit is contained in:
parent
3c62767873
commit
e8f37dd2b2
1 changed files with 5 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue