fix compatibility with the option 'hide-when-no-apps'

This commit is contained in:
Simon Vieille 2020-08-12 14:06:52 +02:00
parent ffab77aff2
commit 9d9afff08d
Signed by: deblan
GPG key ID: 03383D15A1D31745
3 changed files with 18 additions and 3 deletions

View file

@ -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'];

View file

@ -61,7 +61,15 @@ export default {
.then(function(response) {
that.items = response.data.items
jQuery('body').trigger('side-menu.apps', [])
let apps = []
for (let category of that.items) {
for (let app of category.apps) {
apps.push(app)
}
}
jQuery('body').trigger('side-menu.apps', [apps])
});
},
retrieveActiveApp() {

View file

@ -197,8 +197,6 @@ $choicesSizes = [
</label>
</div>
<p><em>If the <code>big menu</code> is enabled then the menu will be hidden in public pages.</em></p>
<div>
<select id="side-menu-hide-when-no-apps" name="hide-when-no-apps" class="side-menu-setting">
<?php foreach ($choicesYesNo as $label => $value): ?>