diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 11a42fb529..936f09154d 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -161,6 +161,7 @@ class ViewController extends Controller { $user = $this->userSession->getUser()->getUID(); + //Load QuickAccess-Defaults $sorting=$this->config->getUserValue($user,$this->appName,'quickaccess_sorting_strategy','date'); $reverseListSetting=$this->config->getUserValue($user,$this->appName,'quickaccess_reverse_list','false'); if($this->config->getUserValue($user,$this->appName,'show_Quick_Access',true)){ @@ -169,6 +170,20 @@ class ViewController extends Controller { $expanded='false'; } + + //Get Favorite-Folder + $tagger=\OC::$server->getTagManager(); + + $helper= new \OCA\Files\Activity\Helper($tagger); + + try { + $favElements = $helper->getFavoriteFilePaths($this->userSession->getUser()->getUID()); + } catch (\RuntimeException $e) { + $favElements['folders'] = null; + } + + $FavoritesFolderCount=sizeof($favElements['folders']); + \OCA\Files\App::getNavigationManager()->add( [ 'id' => 'favorites', @@ -178,16 +193,14 @@ class ViewController extends Controller { 'quickaccessSortingStrategy' => $sorting, 'quickaccessSortingReverse' => $reverseListSetting, 'order' => 5, - 'name' => $this->l10n->t('Favorites') + 'name' => $this->l10n->t('Favorites'), + //If there are zero elements, add ul end tag directly. + 'favoritescount' => $FavoritesFolderCount ] ); - $tagger=\OC::$server->getTagManager(); - $helper= new \OCA\Files\Activity\Helper($tagger); - $favElements = $helper->getFavoriteFilePaths($this->userSession->getUser()->getUID()); - - $FavoritesFolderCount=sizeof($favElements['folders']); + //Add Favorite-folder as menuentries, if there are any if($FavoritesFolderCount>0){ $NavBarPositionPosition=6; diff --git a/apps/files/templates/appnavigation.php b/apps/files/templates/appnavigation.php index c2f15fde80..1488bee40d 100644 --- a/apps/files/templates/appnavigation.php +++ b/apps/files/templates/appnavigation.php @@ -14,7 +14,7 @@ class="nav-icon- svg"> -
+
style="display: none"> @@ -47,8 +47,10 @@
-