[CORE][ROUTES] Small refactor on entrypoint and RouteLoader
This commit is contained in:
parent
1572261617
commit
97fd7620e7
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
// {{{ License
|
||||
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
|
@ -15,6 +16,7 @@
|
|||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// }}}
|
||||
|
||||
/**
|
||||
|
@ -130,8 +132,9 @@ class GNUsocial implements EventSubscriberInterface
|
|||
string $event_name): RequestEvent
|
||||
{
|
||||
$request = $event->getRequest();
|
||||
if (!(!$event->isMasterRequest() || $request->isXmlHttpRequest()
|
||||
|| 'login' === $request->attributes->get('_route'))) {
|
||||
|
||||
// Save the target path, so we can redirect back after logging in
|
||||
if (!(!$event->isMasterRequest() || $request->isXmlHttpRequest() || 'login' === $request->attributes->get('_route'))) {
|
||||
$this->saveTargetPath($this->session, 'main', $request->getUri());
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ class RouteLoader extends Loader
|
|||
'_format' => $options['format'] ?? 'html',
|
||||
'_fragment' => $options['fragment'] ?? '',
|
||||
'_locale' => $options['locale'] ?? 'en',
|
||||
'template' => $options['template'] ?? 'en',
|
||||
'template' => $options['template'] ?? '',
|
||||
],
|
||||
$options['defaults'] ?? []),
|
||||
// requirements = [] -- param => regex
|
||||
|
|
Loading…
Reference in New Issue
Block a user