diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Config.php | 3 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/ConfigType.php | 5 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/Redirect.php | 3 |
3 files changed, 8 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php index c40d1535..bfc2fff8 100644 --- a/src/Wallabag/CoreBundle/Entity/Config.php +++ b/src/Wallabag/CoreBundle/Entity/Config.php | |||
@@ -16,6 +16,9 @@ use Wallabag\UserBundle\Entity\User; | |||
16 | */ | 16 | */ |
17 | class Config | 17 | class Config |
18 | { | 18 | { |
19 | const REDIRECT_TO_HOMEPAGE = 0; | ||
20 | const REDIRECT_TO_CURRENT_PAGE = 1; | ||
21 | |||
19 | /** | 22 | /** |
20 | * @var int | 23 | * @var int |
21 | * | 24 | * |
diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php index 3b1a8026..7e3b9dd4 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php | |||
@@ -7,6 +7,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | |||
7 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | 7 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
8 | use Symfony\Component\Form\FormBuilderInterface; | 8 | use Symfony\Component\Form\FormBuilderInterface; |
9 | use Symfony\Component\OptionsResolver\OptionsResolver; | 9 | use Symfony\Component\OptionsResolver\OptionsResolver; |
10 | use Wallabag\CoreBundle\Entity\Config; | ||
10 | 11 | ||
11 | class ConfigType extends AbstractType | 12 | class ConfigType extends AbstractType |
12 | { | 13 | { |
@@ -51,8 +52,8 @@ class ConfigType extends AbstractType | |||
51 | ->add('action_mark_as_read', ChoiceType::class, [ | 52 | ->add('action_mark_as_read', ChoiceType::class, [ |
52 | 'label' => 'config.form_settings.action_mark_as_read.label', | 53 | 'label' => 'config.form_settings.action_mark_as_read.label', |
53 | 'choices' => [ | 54 | 'choices' => [ |
54 | 'config.form_settings.action_mark_as_read.redirect_homepage' => '0', | 55 | 'config.form_settings.action_mark_as_read.redirect_homepage' => Config::REDIRECT_TO_HOMEPAGE, |
55 | 'config.form_settings.action_mark_as_read.redirect_current_page' => '1', | 56 | 'config.form_settings.action_mark_as_read.redirect_current_page' => Config::REDIRECT_TO_CURRENT_PAGE, |
56 | ], | 57 | ], |
57 | ]) | 58 | ]) |
58 | ->add('language', ChoiceType::class, [ | 59 | ->add('language', ChoiceType::class, [ |
diff --git a/src/Wallabag/CoreBundle/Helper/Redirect.php b/src/Wallabag/CoreBundle/Helper/Redirect.php index 918d9266..59172db4 100644 --- a/src/Wallabag/CoreBundle/Helper/Redirect.php +++ b/src/Wallabag/CoreBundle/Helper/Redirect.php | |||
@@ -4,6 +4,7 @@ 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 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; |
7 | use Wallabag\CoreBundle\Entity\Config; | ||
7 | 8 | ||
8 | /** | 9 | /** |
9 | * Manage redirections to avoid redirecting to empty routes. | 10 | * Manage redirections to avoid redirecting to empty routes. |
@@ -27,7 +28,7 @@ class Redirect | |||
27 | */ | 28 | */ |
28 | public function to($url, $fallback = '') | 29 | public function to($url, $fallback = '') |
29 | { | 30 | { |
30 | if ($this->actionMarkAsRead == 0) { | 31 | if (Config::REDIRECT_TO_HOMEPAGE === $this->actionMarkAsRead) { |
31 | return $this->router->generate('homepage'); | 32 | return $this->router->generate('homepage'); |
32 | } | 33 | } |
33 | 34 | ||