use OCP\EventDispatcher\GenericEvent in more places

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2019-12-09 14:24:57 +01:00
parent 7d1206f6f2
commit 1c585d2c50
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
3 changed files with 8 additions and 4 deletions

View File

@ -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;
}

View File

@ -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());

View File

@ -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());
}
}