add config proxy
This commit is contained in:
@@ -21,20 +21,20 @@ namespace OCA\SideMenu\Controller;
|
||||
use OC;
|
||||
use OC\App\AppStore\Fetcher\CategoryFetcher;
|
||||
use OC\URLGenerator;
|
||||
use OCA\SideMenu\AppInfo\Application;
|
||||
use OCA\SideMenu\Service\AppRepository;
|
||||
use OCA\SideMenu\Service\ConfigProxy;
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http\JSONResponse;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\IRequest;
|
||||
use OCP\IUserSession;
|
||||
use OCP\L10N\IFactory;
|
||||
use OCA\SideMenu\AppInfo\Application;
|
||||
|
||||
class NavController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var IConfig
|
||||
* @var ConfigProxy
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
@@ -59,19 +59,13 @@ class NavController extends Controller
|
||||
protected $router;
|
||||
|
||||
/**
|
||||
* @param string $appName
|
||||
* @param IRequest $request
|
||||
* @param string $appName
|
||||
* @param IConfig $config
|
||||
* @param AppRepository $appRepository
|
||||
* @param CategoryFetcher $categoryFetcher
|
||||
* @param URLGenerator $router
|
||||
* @param IL10N $trans
|
||||
* @param IFactory $l10nFactory
|
||||
*/
|
||||
public function __construct(
|
||||
$appName,
|
||||
IRequest $request,
|
||||
IConfig $config,
|
||||
ConfigProxy $config,
|
||||
AppRepository $appRepository,
|
||||
CategoryFetcher $categoryFetcher,
|
||||
URLGenerator $router,
|
||||
@@ -99,7 +93,7 @@ class NavController extends Controller
|
||||
$apps = $this->appRepository->getVisibleApps();
|
||||
$currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2);
|
||||
$categoriesLabels = $this->categoryFetcher->get();
|
||||
$externalSitesInTopMenu = (bool) $this->config->getAppValue(Application::APP_ID, 'external-sites-in-top-menu', 0);
|
||||
$externalSitesInTopMenu = $this->config->getAppValueBool('external-sites-in-top-menu', 0);
|
||||
$user = OC::$server[IUserSession::class]->getUser();
|
||||
$appsCategories = [];
|
||||
$categoriesAppsCount = [];
|
||||
@@ -111,8 +105,8 @@ class NavController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
$topMenuApps = (array) json_decode($this->config->getAppValue(Application::APP_ID, 'top-menu-apps', '[]'), true);
|
||||
$userTopMenuApps = (array) json_decode($this->config->getUserValue($user->getUid(), Application::APP_ID, 'top-menu-apps', '[]'), true);
|
||||
$topMenuApps = $this->config->getAppValueArray('top-menu-apps', '[]');
|
||||
$userTopMenuApps = $this->config->getUserValueArray($user, 'top-menu-apps', '[]');
|
||||
|
||||
if (!empty($userTopMenuApps)) {
|
||||
$topMenuApps = $userTopMenuApps;
|
||||
|
||||
Reference in New Issue
Block a user