mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 09:22:33 +00:00
Expand test coverage and improve transaction management code.
This commit is contained in:
@@ -50,7 +50,7 @@ trait UserNavigation
|
||||
*/
|
||||
protected function getPreviousUri(string $identifier): string
|
||||
{
|
||||
Log::debug(sprintf('Trying to retrieve URL stored under "%s"', $identifier));
|
||||
// Log::debug(sprintf('Trying to retrieve URL stored under "%s"', $identifier));
|
||||
// "forbidden" words for specific identifiers:
|
||||
// if these are in the previous URI, don't refer back there.
|
||||
$array = [
|
||||
@@ -67,24 +67,24 @@ trait UserNavigation
|
||||
'transactions.mass-delete.uri' => '/transactions/show/',
|
||||
];
|
||||
$forbidden = $array[$identifier] ?? '/show/';
|
||||
Log::debug(sprintf('The forbidden word for %s is "%s"', $identifier, $forbidden));
|
||||
//Log::debug(sprintf('The forbidden word for %s is "%s"', $identifier, $forbidden));
|
||||
|
||||
$uri = (string)session($identifier);
|
||||
Log::debug(sprintf('The URI is %s', $uri));
|
||||
//Log::debug(sprintf('The URI is %s', $uri));
|
||||
if (
|
||||
!(false === strpos($identifier, 'delete'))
|
||||
&& !(false === strpos($uri, $forbidden))) {
|
||||
$uri = $this->redirectUri;
|
||||
Log::debug(sprintf('URI is now %s (identifier contains "delete")', $uri));
|
||||
//Log::debug(sprintf('URI is now %s (identifier contains "delete")', $uri));
|
||||
}
|
||||
if (!(false === strpos($uri, 'jscript'))) {
|
||||
$uri = $this->redirectUri; // @codeCoverageIgnore
|
||||
Log::debug(sprintf('URI is now %s (uri contains jscript)', $uri));
|
||||
//Log::debug(sprintf('URI is now %s (uri contains jscript)', $uri));
|
||||
}
|
||||
|
||||
// more debug notes:
|
||||
Log::debug(sprintf('strpos($identifier, "delete"): %s', var_export(strpos($identifier, 'delete'), true)));
|
||||
Log::debug(sprintf('strpos($uri, $forbidden): %s', var_export(strpos($uri, $forbidden), true)));
|
||||
//Log::debug(sprintf('strpos($identifier, "delete"): %s', var_export(strpos($identifier, 'delete'), true)));
|
||||
//Log::debug(sprintf('strpos($uri, $forbidden): %s', var_export(strpos($uri, $forbidden), true)));
|
||||
|
||||
return $uri;
|
||||
}
|
||||
@@ -154,10 +154,10 @@ trait UserNavigation
|
||||
if (null === $errors || (null !== $errors && 0 === $errors->count())) {
|
||||
$url = app('url')->previous();
|
||||
session()->put($identifier, $url);
|
||||
Log::debug(sprintf('Will put previous URI in cache under key %s: %s', $identifier, $url));
|
||||
//Log::debug(sprintf('Will put previous URI in cache under key %s: %s', $identifier, $url));
|
||||
|
||||
return;
|
||||
}
|
||||
Log::debug(sprintf('The users session contains errors somehow so we will not remember the URI!: %s', var_export($errors, true)));
|
||||
//Log::debug(sprintf('The users session contains errors somehow so we will not remember the URI!: %s', var_export($errors, true)));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user