aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Helper/Redirect.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-06 12:02:39 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-11-16 23:07:34 +0100
commita42f38d9fb7906b785285fab2a09f8c2b9efe996 (patch)
tree8f85793b17497827d063527a339aea42d81ed483 /src/Wallabag/CoreBundle/Helper/Redirect.php
parente042a5d78fc7676eb399f61d199e8ec0045fbd1f (diff)
downloadwallabag-a42f38d9fb7906b785285fab2a09f8c2b9efe996.tar.gz
wallabag-a42f38d9fb7906b785285fab2a09f8c2b9efe996.tar.zst
wallabag-a42f38d9fb7906b785285fab2a09f8c2b9efe996.zip
Added a configuration to define the redirection after archiving an entry
Fix #496
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper/Redirect.php')
-rw-r--r--src/Wallabag/CoreBundle/Helper/Redirect.php9
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 @@
3namespace Wallabag\CoreBundle\Helper; 3namespace Wallabag\CoreBundle\Helper;
4 4
5use Symfony\Component\Routing\Router; 5use Symfony\Component\Routing\Router;
6use 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;
10class Redirect 11class 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 }