fix compatibility with the option 'hide-when-no-apps'
This commit is contained in:
@@ -27,6 +27,8 @@ use OCP\IL10N;
|
||||
use OCP\IRequest;
|
||||
use OCP\L10N\IFactory;
|
||||
use OC\URLGenerator;
|
||||
use OC;
|
||||
use OCP\IUserSession;
|
||||
|
||||
class NavController extends Controller
|
||||
{
|
||||
@@ -96,10 +98,17 @@ class NavController extends Controller
|
||||
$currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2);
|
||||
$categoriesLabels = $this->categoryFetcher->get();
|
||||
$externalSitesInTopMenu = (bool) $this->config->getAppValue('side_menu', 'external-sites-in-top-menu', 0);
|
||||
$user = OC::$server[IUserSession::class]->getUser();
|
||||
$appsCategories = [];
|
||||
$categoriesAppsCount = [];
|
||||
$items = [];
|
||||
|
||||
if (!$user) {
|
||||
return new JSONResponse([
|
||||
'items' => $items,
|
||||
]);
|
||||
}
|
||||
|
||||
foreach ($categoriesLabels as $k => $category) {
|
||||
$categoriesLabels[$category['id']] = $category['translations'][$currentLanguage]['name'] ?? $category['translations']['en']['name'];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user