From 26c3e972d5cac13ed4d8d020ab14d459a9f3a3a3 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Sat, 14 Jan 2023 09:31:10 +0545 Subject: [PATCH] Add a default Event to dispatch events with just a name --- apps/files/lib/Controller/ViewController.php | 3 ++- apps/files_sharing/lib/Controllers/ShareController.php | 3 ++- settings/users.php | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 33f14d3658d2..e613d794aa8a 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -43,6 +43,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; use OCP\AppFramework\Http; use Symfony\Component\EventDispatcher\GenericEvent; +use Symfony\Contracts\EventDispatcher\Event; /** * Class ViewController @@ -243,7 +244,7 @@ public function index($dir = '', $view = '', $fileid = null, $details = null) { $contentItems[] = $contentItem; } - $this->eventDispatcher->dispatch('OCA\Files::loadAdditionalScripts'); + $this->eventDispatcher->dispatch(new Event(), 'OCA\Files::loadAdditionalScripts'); $params = []; $params['usedSpacePercent'] = (int)$storageInfo['relative']; diff --git a/apps/files_sharing/lib/Controllers/ShareController.php b/apps/files_sharing/lib/Controllers/ShareController.php index 43f54eb8c14a..005279171e3e 100644 --- a/apps/files_sharing/lib/Controllers/ShareController.php +++ b/apps/files_sharing/lib/Controllers/ShareController.php @@ -56,6 +56,7 @@ use OCP\Template; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\GenericEvent; +use Symfony\Contracts\EventDispatcher\Event; /** * Class ShareController @@ -394,7 +395,7 @@ public function showShare($token, $path = '') { $shareTmpl['previewImage'] = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'favicon-fb.png')); } - $this->eventDispatcher->dispatch('OCA\Files_Sharing::loadAdditionalScripts'); + $this->eventDispatcher->dispatch(new Event(), 'OCA\Files_Sharing::loadAdditionalScripts'); $csp = new OCP\AppFramework\Http\ContentSecurityPolicy(); $csp->addAllowedFrameDomain('\'self\''); diff --git a/settings/users.php b/settings/users.php index 8f3fb151c121..b8a734f69d1c 100644 --- a/settings/users.php +++ b/settings/users.php @@ -34,6 +34,8 @@ * */ +use Symfony\Contracts\EventDispatcher\Event; + OC_Util::checkSubAdminUser(); \OC::$server->getNavigationManager()->setActiveEntry('core_users'); @@ -104,7 +106,7 @@ $defaultQuotaIsUserDefined=\array_search($defaultQuota, $quotaPreset)===false && \array_search($defaultQuota, ['none', 'default'])===false; -\OC::$server->getEventDispatcher()->dispatch('OC\Settings\Users::loadAdditionalScripts'); +\OC::$server->getEventDispatcher()->dispatch(new Event(), 'OC\Settings\Users::loadAdditionalScripts'); $tmpl = new OC_Template("settings", "users/main", "user"); $tmpl->assign('groups', $groups);