diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper/Redirect.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/Redirect.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/Redirect.php b/src/Wallabag/CoreBundle/Helper/Redirect.php index c14c79d1..918d9266 100644 --- a/src/Wallabag/CoreBundle/Helper/Redirect.php +++ b/src/Wallabag/CoreBundle/Helper/Redirect.php | |||
@@ -3,6 +3,7 @@ | |||
3 | namespace Wallabag\CoreBundle\Helper; | 3 | namespace Wallabag\CoreBundle\Helper; |
4 | 4 | ||
5 | use Symfony\Component\Routing\Router; | 5 | use Symfony\Component\Routing\Router; |
6 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; | ||
6 | 7 | ||
7 | /** | 8 | /** |
8 | * Manage redirections to avoid redirecting to empty routes. | 9 | * Manage redirections to avoid redirecting to empty routes. |
@@ -10,10 +11,12 @@ use Symfony\Component\Routing\Router; | |||
10 | class Redirect | 11 | class Redirect |
11 | { | 12 | { |
12 | private $router; | 13 | private $router; |
14 | private $actionMarkAsRead; | ||
13 | 15 | ||
14 | public function __construct(Router $router) | 16 | public function __construct(Router $router, TokenStorage $token) |
15 | { | 17 | { |
16 | $this->router = $router; | 18 | $this->router = $router; |
19 | $this->actionMarkAsRead = $token->getToken()->getUser()->getConfig()->getActionMarkAsRead(); | ||
17 | } | 20 | } |
18 | 21 | ||
19 | /** | 22 | /** |
@@ -24,6 +27,10 @@ class Redirect | |||
24 | */ | 27 | */ |
25 | public function to($url, $fallback = '') | 28 | public function to($url, $fallback = '') |
26 | { | 29 | { |
30 | if ($this->actionMarkAsRead == 0) { | ||
31 | return $this->router->generate('homepage'); | ||
32 | } | ||
33 | |||
27 | if (null !== $url) { | 34 | if (null !== $url) { |
28 | return $url; | 35 | return $url; |
29 | } | 36 | } |