forked from GNUsocial/gnu-social
[CORE][ROUTES] Small refactor on entrypoint and RouteLoader
This commit is contained in:
parent
92ecb50cff
commit
f812d9142f
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// {{{ License
|
// {{{ License
|
||||||
|
|
||||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
// 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
|
// 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
|
// 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/>.
|
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -130,8 +132,9 @@ class GNUsocial implements EventSubscriberInterface
|
|||||||
string $event_name): RequestEvent
|
string $event_name): RequestEvent
|
||||||
{
|
{
|
||||||
$request = $event->getRequest();
|
$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());
|
$this->saveTargetPath($this->session, 'main', $request->getUri());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ class RouteLoader extends Loader
|
|||||||
'_format' => $options['format'] ?? 'html',
|
'_format' => $options['format'] ?? 'html',
|
||||||
'_fragment' => $options['fragment'] ?? '',
|
'_fragment' => $options['fragment'] ?? '',
|
||||||
'_locale' => $options['locale'] ?? 'en',
|
'_locale' => $options['locale'] ?? 'en',
|
||||||
'template' => $options['template'] ?? 'en',
|
'template' => $options['template'] ?? '',
|
||||||
],
|
],
|
||||||
$options['defaults'] ?? []),
|
$options['defaults'] ?? []),
|
||||||
// requirements = [] -- param => regex
|
// requirements = [] -- param => regex
|
||||||
|
Loading…
Reference in New Issue
Block a user