diff options
author | Robin Appelman <robin@icewind.nl> | 2021-08-09 16:06:23 +0200 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2021-10-19 11:31:07 +0200 |
commit | 4b82d8d20c5222d0f36b792f3a252c81cbacbb59 (patch) | |
tree | b0a15504f0d2c523b889f982b62bbb3fb3a554d3 /apps/files_sharing/lib/AppInfo | |
parent | ab275c5e38de80b6cbc1a60890d8076f5075cace (diff) | |
download | nextcloud-server-4b82d8d20c5222d0f36b792f3a252c81cbacbb59.tar.gz nextcloud-server-4b82d8d20c5222d0f36b792f3a252c81cbacbb59.zip |
call setupSharingMenus again
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_sharing/lib/AppInfo')
-rw-r--r-- | apps/files_sharing/lib/AppInfo/Application.php | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php index 9d2ddec544a..7a432650f12 100644 --- a/apps/files_sharing/lib/AppInfo/Application.php +++ b/apps/files_sharing/lib/AppInfo/Application.php @@ -33,6 +33,7 @@ use OC\Share\Share; use OCA\Files_Sharing\Capabilities; use OCA\Files_Sharing\Event\BeforeTemplateRenderedEvent; use OCA\Files_Sharing\External\Manager; +use OCA\Files_Sharing\External\MountProvider as ExternalMountProvider; use OCA\Files_Sharing\Helper; use OCA\Files_Sharing\Listener\LegacyBeforeTemplateRenderedListener; use OCA\Files_Sharing\Listener\LoadAdditionalListener; @@ -60,7 +61,9 @@ use OCP\Files\Config\IMountProviderCollection; use OCP\Group\Events\UserAddedEvent; use OCP\IDBConnection; use OCP\IGroup; +use OCP\INavigationManager; use OCP\IUserSession; +use OCP\L10N\IFactory; use OCP\Share\Events\ShareCreatedEvent; use OCP\Share\IManager; use OCP\Util; @@ -76,8 +79,8 @@ class Application extends App implements IBootstrap { } public function register(IRegistrationContext $context): void { - $context->registerService('ExternalMountProvider', function (ContainerInterface $c) { - return new \OCA\Files_Sharing\External\MountProvider( + $context->registerService(ExternalMountProvider::class, function (ContainerInterface $c) { + return new ExternalMountProvider( $c->get(IDBConnection::class), function () use ($c) { return $c->get(Manager::class); @@ -101,6 +104,7 @@ class Application extends App implements IBootstrap { public function boot(IBootContext $context): void { $context->injectFn([$this, 'registerMountProviders']); $context->injectFn([$this, 'registerEventsScripts']); + $context->injectFn([$this, 'setupSharingMenus']); Helper::registerHooks(); @@ -114,9 +118,9 @@ class Application extends App implements IBootstrap { } - public function registerMountProviders(IMountProviderCollection $mountProviderCollection) { - $mountProviderCollection->registerProvider($this->getContainer()->query(MountProvider::class)); - $mountProviderCollection->registerProvider($this->getContainer()->query('ExternalMountProvider')); + public function registerMountProviders(IMountProviderCollection $mountProviderCollection, MountProvider $mountProvider, ExternalMountProvider $externalMountProvider) { + $mountProviderCollection->registerProvider($mountProvider); + $mountProviderCollection->registerProvider($externalMountProvider); } public function registerEventsScripts(IEventDispatcher $dispatcher, EventDispatcherInterface $oldDispatcher) { @@ -144,19 +148,14 @@ class Application extends App implements IBootstrap { }); } - protected function setupSharingMenus() { - /** @var IManager $shareManager */ - $shareManager = \OC::$server->get(IManager::class); - + public function setupSharingMenus(INavigationManager $navigationManager, IManager $shareManager, IFactory $l10nFactory, IUserSession $userSession) { if (!$shareManager->shareApiEnabled() || !class_exists('\OCA\Files\App')) { return; } // show_Quick_Access stored as string - \OCA\Files\App::getNavigationManager()->add(function () use ($shareManager) { - $l = \OC::$server->getL10N('files_sharing'); - /** @var IUserSession $userSession */ - $userSession = \OC::$server->get(IUserSession::class); + $navigationManager->add(function () use ($shareManager, $l10nFactory, $userSession) { + $l = $l10nFactory->get('files_sharing'); $user = $userSession->getUser(); $userId = $user ? $user->getUID() : null; |