Use dispatchTyped instead of dispatch on the new event dispatcher
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
92b67409fa
commit
a5853d7ecc
|
@ -30,7 +30,9 @@ use OCP\EventDispatcher\GenericEvent;
|
||||||
OCP\User::checkLoggedIn();
|
OCP\User::checkLoggedIn();
|
||||||
$config = \OC::$server->getConfig();
|
$config = \OC::$server->getConfig();
|
||||||
$userSession = \OC::$server->getUserSession();
|
$userSession = \OC::$server->getUserSession();
|
||||||
$eventDispatcher = \OC::$server->getEventDispatcher();
|
$legacyEventDispatcher = \OC::$server->getEventDispatcher();
|
||||||
|
/** @var \OCP\EventDispatcher\IEventDispatcher $eventDispatcher */
|
||||||
|
$eventDispatcher = \OC::$server->get(OCP\EventDispatcher\IEventDispatcher::class);
|
||||||
|
|
||||||
$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', false);
|
$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', false);
|
||||||
$isIE = \OCP\Util::isIE();
|
$isIE = \OCP\Util::isIE();
|
||||||
|
@ -41,13 +43,13 @@ $tmpl = new OCP\Template('files_sharing', 'list', '');
|
||||||
$tmpl->assign('showgridview', $showgridview && !$isIE);
|
$tmpl->assign('showgridview', $showgridview && !$isIE);
|
||||||
|
|
||||||
// fire script events
|
// fire script events
|
||||||
$eventDispatcher->dispatch('\OCP\Collaboration\Resources::loadAdditionalScripts', new GenericEvent());
|
$legacyEventDispatcher->dispatch('\OCP\Collaboration\Resources::loadAdditionalScripts', new GenericEvent());
|
||||||
$eventDispatcher->dispatch(LoadAdditionalScriptsEvent::class, new LoadAdditionalScriptsEvent());
|
$eventDispatcher->dispatchTyped(new LoadAdditionalScriptsEvent());
|
||||||
$eventDispatcher->dispatch(LoadSidebar::class, new LoadSidebar());
|
$eventDispatcher->dispatchTyped(new LoadSidebar());
|
||||||
|
|
||||||
// Load Viewer scripts
|
// Load Viewer scripts
|
||||||
if (class_exists(LoadViewer::class)) {
|
if (class_exists(LoadViewer::class)) {
|
||||||
$eventDispatcher->dispatch(LoadViewer::class, new LoadViewer());
|
$eventDispatcher->dispatchTyped(new LoadViewer());
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmpl->printPage();
|
$tmpl->printPage();
|
||||||
|
|
|
@ -81,7 +81,7 @@ class BackupCodeStorage {
|
||||||
$result[] = $code;
|
$result[] = $code;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->eventDispatcher->dispatch(CodesGenerated::class, new CodesGenerated($user));
|
$this->eventDispatcher->dispatchTyped(new CodesGenerated($user));
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,9 +82,8 @@ class BackupCodeStorageTest extends TestCase {
|
||||||
->method('insert')
|
->method('insert')
|
||||||
->with($this->equalTo($row));
|
->with($this->equalTo($row));
|
||||||
$this->eventDispatcher->expects($this->once())
|
$this->eventDispatcher->expects($this->once())
|
||||||
->method('dispatch')
|
->method('dispatchTyped')
|
||||||
->with(
|
->with(
|
||||||
$this->equalTo(CodesGenerated::class),
|
|
||||||
$this->equalTo(new CodesGenerated($user))
|
$this->equalTo(new CodesGenerated($user))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1947,13 +1947,10 @@
|
||||||
</UndefinedMethod>
|
</UndefinedMethod>
|
||||||
</file>
|
</file>
|
||||||
<file src="apps/files_sharing/list.php">
|
<file src="apps/files_sharing/list.php">
|
||||||
<InvalidArgument occurrences="4">
|
<InvalidArgument occurrences="1">
|
||||||
<code>'\OCP\Collaboration\Resources::loadAdditionalScripts'</code>
|
<code>'\OCP\Collaboration\Resources::loadAdditionalScripts'</code>
|
||||||
<code>LoadAdditionalScriptsEvent::class</code>
|
|
||||||
<code>LoadSidebar::class</code>
|
|
||||||
<code>LoadViewer::class</code>
|
|
||||||
</InvalidArgument>
|
</InvalidArgument>
|
||||||
<TooManyArguments occurrences="4">
|
<TooManyArguments occurrences="1">
|
||||||
<code>dispatch</code>
|
<code>dispatch</code>
|
||||||
<code>dispatch</code>
|
<code>dispatch</code>
|
||||||
<code>dispatch</code>
|
<code>dispatch</code>
|
||||||
|
|
Loading…
Reference in New Issue