aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/lib
diff options
context:
space:
mode:
authorfnuesse <felix.nuesse@t-online.de>2018-06-17 22:21:11 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-07-12 16:49:38 +0200
commitce05cb371b044d08b45b49303f76d23a7fe84875 (patch)
tree4f8ebb574f3d297fc8b727d3e661021f4d986034 /apps/files/lib
parentfc4baed6e5e862492ac1e2f12a408971d8ee6a26 (diff)
downloadnextcloud-server-ce05cb371b044d08b45b49303f76d23a7fe84875.tar.gz
nextcloud-server-ce05cb371b044d08b45b49303f76d23a7fe84875.zip
Fixed complete app-breakdown if no favorites are set
Signed-off-by: fnuesse <felix.nuesse@t-online.de> Hid three-dot menu if no favorites are selected Signed-off-by: fnuesse <felix.nuesse@t-online.de>
Diffstat (limited to 'apps/files/lib')
-rw-r--r--apps/files/lib/Controller/ViewController.php25
1 files changed, 19 insertions, 6 deletions
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php
index 11a42fb5291..936f09154dd 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;