From 7d1206f6f2e6b54bb3d6f9cdb0d8a00de7a1ba9d Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 5 Dec 2019 16:05:18 +0100 Subject: [PATCH 1/2] use OCP\EventDispatcher\GenericEvent for loading additional scripts in the files app Signed-off-by: Robin Appelman --- apps/files/lib/Listener/LegacyLoadAdditionalScriptsAdapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files/lib/Listener/LegacyLoadAdditionalScriptsAdapter.php b/apps/files/lib/Listener/LegacyLoadAdditionalScriptsAdapter.php index ba89d59122..470159b779 100644 --- a/apps/files/lib/Listener/LegacyLoadAdditionalScriptsAdapter.php +++ b/apps/files/lib/Listener/LegacyLoadAdditionalScriptsAdapter.php @@ -28,7 +28,7 @@ use OC\EventDispatcher\SymfonyAdapter; use OCA\Files\Event\LoadAdditionalScriptsEvent; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; -use Symfony\Component\EventDispatcher\GenericEvent; +use OCP\EventDispatcher\GenericEvent; class LegacyLoadAdditionalScriptsAdapter implements IEventListener { From 1c585d2c502482624497f8e7d82a4f75f70c439c Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 9 Dec 2019 14:24:57 +0100 Subject: [PATCH 2/2] use OCP\EventDispatcher\GenericEvent in more places Signed-off-by: Robin Appelman --- apps/files_external/lib/Service/BackendService.php | 4 +++- apps/files_sharing/list.php | 3 ++- .../AppFramework/Middleware/AdditionalScriptsMiddleware.php | 5 +++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/files_external/lib/Service/BackendService.php b/apps/files_external/lib/Service/BackendService.php index 167b1017b0..adfe6b0a9c 100644 --- a/apps/files_external/lib/Service/BackendService.php +++ b/apps/files_external/lib/Service/BackendService.php @@ -30,6 +30,7 @@ use OCA\Files_External\Lib\Auth\AuthMechanism; use OCA\Files_External\Lib\Backend\Backend; use OCA\Files_External\Lib\Config\IAuthMechanismProvider; use OCA\Files_External\Lib\Config\IBackendProvider; +use OCP\EventDispatcher\GenericEvent; use OCP\IConfig; /** @@ -110,7 +111,8 @@ class BackendService { static $eventSent = false; if(!$eventSent) { \OC::$server->getEventDispatcher()->dispatch( - 'OCA\\Files_External::loadAdditionalBackends' + 'OCA\\Files_External::loadAdditionalBackends', + new GenericEvent() ); $eventSent = true; } diff --git a/apps/files_sharing/list.php b/apps/files_sharing/list.php index fdff5d36c7..bde3ddd95e 100644 --- a/apps/files_sharing/list.php +++ b/apps/files_sharing/list.php @@ -21,6 +21,7 @@ */ use OCA\Files\Event\LoadAdditionalScriptsEvent; use OCA\Files\Event\LoadSidebar; +use OCP\EventDispatcher\GenericEvent; // Check if we are a user OCP\User::checkLoggedIn(); @@ -37,7 +38,7 @@ $tmpl = new OCP\Template('files_sharing', 'list', ''); $tmpl->assign('showgridview', $showgridview && !$isIE); // fire script events -$eventDispatcher->dispatch('\OCP\Collaboration\Resources::loadAdditionalScripts'); +$eventDispatcher->dispatch('\OCP\Collaboration\Resources::loadAdditionalScripts', new GenericEvent()); $eventDispatcher->dispatch(LoadAdditionalScriptsEvent::class, new LoadAdditionalScriptsEvent()); $eventDispatcher->dispatch(LoadSidebar::class, new LoadSidebar()); diff --git a/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php b/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php index 3ab084cd89..c65f8f8493 100644 --- a/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php +++ b/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php @@ -29,6 +29,7 @@ use OCP\AppFramework\Http\StandaloneTemplateResponse; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Middleware; use OCP\AppFramework\PublicShareController; +use OCP\EventDispatcher\GenericEvent; use OCP\IUserSession; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -53,10 +54,10 @@ class AdditionalScriptsMiddleware extends Middleware { } if ($response instanceof TemplateResponse) { - $this->dispatcher->dispatch(TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS); + $this->dispatcher->dispatch(TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS, new GenericEvent()); if (!($response instanceof StandaloneTemplateResponse) && $this->userSession->isLoggedIn()) { - $this->dispatcher->dispatch(TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN); + $this->dispatcher->dispatch(TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN, new GenericEvent()); } }