[CORE][ROUTES] Small refactor on entrypoint and RouteLoader

This commit is contained in:
Hugo Sales 2020-07-23 22:51:07 +00:00 committed by Hugo Sales
parent 92ecb50cff
commit f812d9142f
2 changed files with 6 additions and 3 deletions

View File

@ -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());
}

View File

@ -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