add add top-menu-apps option in the personal settings

This commit is contained in:
Simon Vieille
2020-08-12 15:59:51 +02:00
parent 9d9afff08d
commit a1b1396b63
6 changed files with 91 additions and 7 deletions
+10 -1
View File
@@ -24,6 +24,7 @@ use OCP\ILogger;
use OCP\Settings\ISettings;
use OCP\IConfig;
use OCP\IUserSession;
use OCA\SideMenu\Service\AppRepository;
class Personal implements ISettings
{
@@ -47,12 +48,18 @@ class Personal implements ISettings
*/
private $userSession;
public function __construct(IL10N $l, ILogger $logger, IConfig $config, IUserSession $userSession)
/**
* @var AppRepository
*/
private $appRepository;
public function __construct(IL10N $l, ILogger $logger, IConfig $config, IUserSession $userSession, AppRepository $appRepository)
{
$this->l = $l;
$this->logger = $logger;
$this->config = $config;
$this->userSession = $userSession;
$this->appRepository = $appRepository;
}
/**
@@ -64,6 +71,8 @@ class Personal implements ISettings
$parameters = [
'enabled' => $this->config->getUserValue($user->getUid(), 'side_menu', 'enabled', '1'),
'top-menu-apps' => (array) json_decode($this->config->getUserValue($user->getUid(), 'side_menu', 'top-menu-apps', '[]'), true),
'apps' => $this->appRepository->getVisibleApps(),
];
return new TemplateResponse('side_menu', 'settings/personal-form', $parameters, '');