[EVENT] Rename event names to camel case to make finding handlers easier

This commit is contained in:
Hugo Sales 2020-10-19 18:22:59 +00:00 committed by Hugo Sales
parent 0b759da780
commit 1949e0b987
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
6 changed files with 8 additions and 8 deletions

View File

@ -154,7 +154,7 @@ class UserPanel extends AbstractController
if ($old_file != null) { if ($old_file != null) {
@unlink($old_file); @unlink($old_file);
} }
Event::handle('delete_cached_avatar', [$user->getNickname()]); Event::handle('DeleteCachedAvatar', [$user->getNickname()]);
} }
return ['_template' => 'settings/avatar.html.twig', 'avatar' => $form->createView()]; return ['_template' => 'settings/avatar.html.twig', 'avatar' => $form->createView()];
@ -205,7 +205,7 @@ class UserPanel extends AbstractController
} }
} }
Event::handle('add_notification_transport', [&$form_defs]); Event::handle('AddNotificationTransport', [&$form_defs]);
unset($form_defs['placeholder']); unset($form_defs['placeholder']);
$tabbed_forms = []; $tabbed_forms = [];

View File

@ -63,7 +63,7 @@ class Controller extends AbstractController implements EventSubscriberInterface
$request = $event->getRequest(); $request = $event->getRequest();
$this->vars = ['controler' => $controller, 'request' => $request, 'have_user' => Common::user() !== null]; $this->vars = ['controler' => $controller, 'request' => $request, 'have_user' => Common::user() !== null];
Event::handle('start_twig_populate_vars', [&$this->vars]); Event::handle('StartTwigPopulateVars', [&$this->vars]);
$event->stopPropagation(); $event->stopPropagation();
return $event; return $event;
@ -78,7 +78,7 @@ class Controller extends AbstractController implements EventSubscriberInterface
} }
$this->vars = array_merge_recursive($this->vars, $response); $this->vars = array_merge_recursive($this->vars, $response);
Event::handle('end_twig_populate_vars', [&$this->vars]); Event::handle('EndTwigPopulateVars', [&$this->vars]);
$template = $this->vars['_template']; $template = $this->vars['_template'];
unset($this->vars['_template'], $this->vars['request']); unset($this->vars['_template'], $this->vars['request']);

View File

@ -75,7 +75,7 @@ class ModuleManager
F\map(F\select(get_class_methods($obj), F\map(F\select(get_class_methods($obj),
F\ary(F\partial_right('App\Util\Formatting::startsWith', 'on'), 1)), F\ary(F\partial_right('App\Util\Formatting::startsWith', 'on'), 1)),
function (string $m) use ($obj) { function (string $m) use ($obj) {
$ev = Formatting::camelCaseToSnakeCase(substr($m, 2)); $ev = substr($m, 2);
$this->events[$ev] = $this->events[$ev] ?? []; $this->events[$ev] = $this->events[$ev] ?? [];
$this->events[$ev][] = [$obj, $m]; $this->events[$ev][] = [$obj, $m];
} }

View File

@ -62,7 +62,7 @@ class RouteLoader extends Loader
$ns::load($this); $ns::load($this);
} }
Event::handle('add_route', [&$this]); Event::handle('AddRoute', [&$this]);
return $this->rc; return $this->rc;
} }

View File

@ -197,7 +197,7 @@ class Note extends Entity
public function getAvatarUrl() public function getAvatarUrl()
{ {
$url = null; $url = null;
Event::handle('get_avatar_url', [$this->getActorNickname(), &$url]); Event::handle('GetAvatarUrl', [$this->getActorNickname(), &$url]);
return $url; return $url;
} }

View File

@ -63,7 +63,7 @@ class Runtime implements RuntimeExtensionInterface, EventSubscriberInterface
public function getNoteActions(Note $note) public function getNoteActions(Note $note)
{ {
$actions = []; $actions = [];
Event::handle('add_note_actions', [$this->request, $note, &$actions]); Event::handle('AddNoteActions', [$this->request, $note, &$actions]);
return $actions; return $actions;
} }