From a94d86a6a4e95a16e5230ba872c84b5b03bc0891 Mon Sep 17 00:00:00 2001 From: "florian.azizian" <florian.azizian@maarch.org> Date: Tue, 23 Jul 2019 10:31:05 +0100 Subject: [PATCH] FEAT #11266 TIME 0:05 rest route for shortcuts --- src/core/controllers/CoreController.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/core/controllers/CoreController.php b/src/core/controllers/CoreController.php index 3cb9b69c218..8ee1b62fbc7 100755 --- a/src/core/controllers/CoreController.php +++ b/src/core/controllers/CoreController.php @@ -127,14 +127,19 @@ class CoreController $shortcuts[] = ['id' => 'search']; } } + + $indexingGroups = []; foreach ($userGroups as $group) { if ($group['can_index']) { - $shortcuts[] = [ - 'id' => 'indexing', - 'groups' => ['id' => $group['id'], 'label' => $group['group_desc']] - ]; + $indexingGroups[] = ['id' => $group['id'], 'label' => $group['group_desc']]; } } + if (!empty($indexingGroups)) { + $shortcuts[] = [ + 'id' => 'indexing', + 'groups' => $indexingGroups + ]; + } return $response->withJson([ 'shortcuts' => $shortcuts -- GitLab