Skip to content

Commit

Permalink
Add a default Event to dispatch events with just a name
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Jan 23, 2023
1 parent b3f72fe commit 26c3e97
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion apps/files/lib/Controller/ViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'];
Expand Down
3 changes: 2 additions & 1 deletion apps/files_sharing/lib/Controllers/ShareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
use OCP\Template;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\GenericEvent;
use Symfony\Contracts\EventDispatcher\Event;

/**
* Class ShareController
Expand Down Expand Up @@ -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\'');
Expand Down
4 changes: 3 additions & 1 deletion settings/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
*
*/

use Symfony\Contracts\EventDispatcher\Event;

OC_Util::checkSubAdminUser();

\OC::$server->getNavigationManager()->setActiveEntry('core_users');
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 26c3e97

Please sign in to comment.