aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--app/DoctrineMigrations/Version20161106113822.php (renamed from app/DoctrineMigrations/Version20161109150755.php)14
-rw-r--r--app/DoctrineMigrations/Version20161117071626.php44
-rw-r--r--docs/de/user/configuration.rst8
-rw-r--r--docs/en/user/configuration.rst9
-rw-r--r--docs/fr/user/configuration.rst9
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php3
-rw-r--r--src/Wallabag/CoreBundle/Entity/Config.php30
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/ConfigType.php8
-rw-r--r--src/Wallabag/CoreBundle/Helper/Redirect.php16
-rw-r--r--src/Wallabag/CoreBundle/Resources/config/services.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml42
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml8
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig8
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig8
-rw-r--r--tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php1
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php65
-rw-r--r--tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php1
-rw-r--r--tests/Wallabag/CoreBundle/Helper/RedirectTest.php59
28 files changed, 335 insertions, 39 deletions
diff --git a/app/DoctrineMigrations/Version20161109150755.php b/app/DoctrineMigrations/Version20161106113822.php
index e4d269c4..edca54f5 100644
--- a/app/DoctrineMigrations/Version20161109150755.php
+++ b/app/DoctrineMigrations/Version20161106113822.php
@@ -7,34 +7,38 @@ use Doctrine\DBAL\Schema\Schema;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface; 7use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
10class Version20161031132655 extends AbstractMigration implements ContainerAwareInterface 10class Version20161106113822 extends AbstractMigration implements ContainerAwareInterface
11{ 11{
12 /** 12 /**
13 * @var ContainerInterface 13 * @var ContainerInterface
14 */ 14 */
15 private $container; 15 private $container;
16
16 public function setContainer(ContainerInterface $container = null) 17 public function setContainer(ContainerInterface $container = null)
17 { 18 {
18 $this->container = $container; 19 $this->container = $container;
19 } 20 }
21
20 private function getTable($tableName) 22 private function getTable($tableName)
21 { 23 {
22 return $this->container->getParameter('database_table_prefix') . $tableName; 24 return $this->container->getParameter('database_table_prefix') . $tableName;
23 } 25 }
26
24 /** 27 /**
25 * @param Schema $schema 28 * @param Schema $schema
26 */ 29 */
27 public function up(Schema $schema) 30 public function up(Schema $schema)
28 { 31 {
29 $this->addSql("INSERT INTO \"".$this->getTable('craue_config_setting')."\" (name, value, section) VALUES ('share_unmark', 0, 'entry')"); 32 $this->addSql('ALTER TABLE '.$this->getTable('config').' ADD action_mark_as_read INT DEFAULT 0');
30 $this->addSql("INSERT INTO \"".$this->getTable('craue_config_setting')."\" (name, value, section) VALUES ('unmark_url', 'https://unmark.it', 'entry')");
31 } 33 }
34
32 /** 35 /**
33 * @param Schema $schema 36 * @param Schema $schema
34 */ 37 */
35 public function down(Schema $schema) 38 public function down(Schema $schema)
36 { 39 {
37 $this->addSql("DELETE FROM \"".$this->getTable('craue_config_setting')."\" WHERE name = 'share_unmark';"); 40 $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'sqlite', 'This down migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.');
38 $this->addSql("DELETE FROM \"".$this->getTable('craue_config_setting')."\" WHERE name = 'unmark_url';"); 41
42 $this->addSql('ALTER TABLE '.$this->getTable('config').' DROP action_mark_as_read');
39 } 43 }
40} 44}
diff --git a/app/DoctrineMigrations/Version20161117071626.php b/app/DoctrineMigrations/Version20161117071626.php
new file mode 100644
index 00000000..9ae55b5f
--- /dev/null
+++ b/app/DoctrineMigrations/Version20161117071626.php
@@ -0,0 +1,44 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface;
9
10class Version20161117071626 extends AbstractMigration implements ContainerAwareInterface
11{
12 /**
13 * @var ContainerInterface
14 */
15 private $container;
16
17 public function setContainer(ContainerInterface $container = null)
18 {
19 $this->container = $container;
20 }
21
22 private function getTable($tableName)
23 {
24 return $this->container->getParameter('database_table_prefix') . $tableName;
25 }
26
27 /**
28 * @param Schema $schema
29 */
30 public function up(Schema $schema)
31 {
32 $this->addSql("INSERT INTO ".$this->getTable('craue_config_setting')." (name, value, section) VALUES ('share_unmark', 0, 'entry')");
33 $this->addSql("INSERT INTO ".$this->getTable('craue_config_setting')." (name, value, section) VALUES ('unmark_url', 'https://unmark.it', 'entry')");
34 }
35
36 /**
37 * @param Schema $schema
38 */
39 public function down(Schema $schema)
40 {
41 $this->addSql("DELETE FROM ".$this->getTable('craue_config_setting')." WHERE name = 'share_unmark';");
42 $this->addSql("DELETE FROM ".$this->getTable('craue_config_setting')." WHERE name = 'unmark_url';");
43 }
44}
diff --git a/docs/de/user/configuration.rst b/docs/de/user/configuration.rst
index 0b0793b1..075a5290 100644
--- a/docs/de/user/configuration.rst
+++ b/docs/de/user/configuration.rst
@@ -28,6 +28,14 @@ Lesegeschwindigkeit
28wallabag berechnet die Lesezeit für jeden Artikel. Du kannst hier definieren, dank dieser Liste, ob du 28wallabag berechnet die Lesezeit für jeden Artikel. Du kannst hier definieren, dank dieser Liste, ob du
29ein schneller oder langsamer Leser bist. wallabag wird die Lesezeit für jeden Artikel neu berechnen. 29ein schneller oder langsamer Leser bist. wallabag wird die Lesezeit für jeden Artikel neu berechnen.
30 30
31Wohin möchtest du weitergeleitet werden, nach dem ein Artikel als gelesen markiert wurde?
32~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33
34Jedes Mal, wenn du eine Aktion ausführst (nach dem Markieren eines Artikels als gelesen oder Favorit, nach dem Löschen eines Artikels oder dem Entfernen eines Tag von einem Eintrag), kannst du weitergeleitet werden:
35
36- zur Homepage
37- zur aktuellen Seite
38
31Sprache 39Sprache
32~~~~~~~ 40~~~~~~~
33 41
diff --git a/docs/en/user/configuration.rst b/docs/en/user/configuration.rst
index e7055a14..e16af12c 100644
--- a/docs/en/user/configuration.rst
+++ b/docs/en/user/configuration.rst
@@ -27,6 +27,15 @@ Reading speed
27wallabag calculates a reading time for each article. You can define here, thanks to this list, if you are 27wallabag calculates a reading time for each article. You can define here, thanks to this list, if you are
28a fast or a slow reader. wallabag will recalculate the reading time for each article. 28a fast or a slow reader. wallabag will recalculate the reading time for each article.
29 29
30Where do you want to be redirected after mark an article as read?
31~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32
33Each time you'll do some actions (after marking an article as read/favorite,
34after deleting an article, after removing a tag from an entry), you can be redirected:
35
36- To the homepage
37- To the current page
38
30Language 39Language
31~~~~~~~~ 40~~~~~~~~
32 41
diff --git a/docs/fr/user/configuration.rst b/docs/fr/user/configuration.rst
index 90eece11..c533b5c5 100644
--- a/docs/fr/user/configuration.rst
+++ b/docs/fr/user/configuration.rst
@@ -27,6 +27,15 @@ Vitesse de lecture
27 27
28wallabag calcule une durée de lecture pour chaque article. Vous pouvez définir ici, grâce à cette liste déroulante, si vous lisez plus ou moins vite. wallabag recalculera la durée de lecture de chaque article. 28wallabag calcule une durée de lecture pour chaque article. Vous pouvez définir ici, grâce à cette liste déroulante, si vous lisez plus ou moins vite. wallabag recalculera la durée de lecture de chaque article.
29 29
30Où souhaitez-vous être redirigé après avoir marqué un article comme lu ?
31~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32
33Chaque fois que vous ferez certaines actions (après avoir marqué un article comme lu / comme favori,
34après avoir supprimé un article, après avoir retiré un tag d'un article), vous pouvez être redirigé :
35
36- sur la page d'accueil
37- sur la page courante
38
30Langue 39Langue
31~~~~~~ 40~~~~~~
32 41
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
index 921c739f..45358022 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
@@ -21,6 +21,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
21 $adminConfig->setReadingSpeed(1); 21 $adminConfig->setReadingSpeed(1);
22 $adminConfig->setLanguage('en'); 22 $adminConfig->setLanguage('en');
23 $adminConfig->setPocketConsumerKey('xxxxx'); 23 $adminConfig->setPocketConsumerKey('xxxxx');
24 $adminConfig->setActionMarkAsRead(0);
24 25
25 $manager->persist($adminConfig); 26 $manager->persist($adminConfig);
26 27
@@ -32,6 +33,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
32 $bobConfig->setReadingSpeed(1); 33 $bobConfig->setReadingSpeed(1);
33 $bobConfig->setLanguage('fr'); 34 $bobConfig->setLanguage('fr');
34 $bobConfig->setPocketConsumerKey(null); 35 $bobConfig->setPocketConsumerKey(null);
36 $bobConfig->setActionMarkAsRead(1);
35 37
36 $manager->persist($bobConfig); 38 $manager->persist($bobConfig);
37 39
@@ -43,6 +45,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
43 $emptyConfig->setReadingSpeed(1); 45 $emptyConfig->setReadingSpeed(1);
44 $emptyConfig->setLanguage('en'); 46 $emptyConfig->setLanguage('en');
45 $emptyConfig->setPocketConsumerKey(null); 47 $emptyConfig->setPocketConsumerKey(null);
48 $emptyConfig->setActionMarkAsRead(0);
46 49
47 $manager->persist($emptyConfig); 50 $manager->persist($emptyConfig);
48 51
diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php
index d0f0e3f3..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 */
17class Config 17class 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 *
@@ -88,6 +91,13 @@ class Config
88 private $pocketConsumerKey; 91 private $pocketConsumerKey;
89 92
90 /** 93 /**
94 * @var int
95 *
96 * @ORM\Column(name="action_mark_as_read", type="integer", nullable=true)
97 */
98 private $actionMarkAsRead;
99
100 /**
91 * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config") 101 * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
92 */ 102 */
93 private $user; 103 private $user;
@@ -310,6 +320,26 @@ class Config
310 } 320 }
311 321
312 /** 322 /**
323 * @return int
324 */
325 public function getActionMarkAsRead()
326 {
327 return $this->actionMarkAsRead;
328 }
329
330 /**
331 * @param int $actionMarkAsRead
332 *
333 * @return Config
334 */
335 public function setActionMarkAsRead($actionMarkAsRead)
336 {
337 $this->actionMarkAsRead = $actionMarkAsRead;
338
339 return $this;
340 }
341
342 /**
313 * @param TaggingRule $rule 343 * @param TaggingRule $rule
314 * 344 *
315 * @return Config 345 * @return Config
diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
index 0bac2874..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;
7use Symfony\Component\Form\Extension\Core\Type\SubmitType; 7use Symfony\Component\Form\Extension\Core\Type\SubmitType;
8use Symfony\Component\Form\FormBuilderInterface; 8use Symfony\Component\Form\FormBuilderInterface;
9use Symfony\Component\OptionsResolver\OptionsResolver; 9use Symfony\Component\OptionsResolver\OptionsResolver;
10use Wallabag\CoreBundle\Entity\Config;
10 11
11class ConfigType extends AbstractType 12class ConfigType extends AbstractType
12{ 13{
@@ -48,6 +49,13 @@ class ConfigType extends AbstractType
48 'config.form_settings.reading_speed.400_word' => '2', 49 'config.form_settings.reading_speed.400_word' => '2',
49 ], 50 ],
50 ]) 51 ])
52 ->add('action_mark_as_read', ChoiceType::class, [
53 'label' => 'config.form_settings.action_mark_as_read.label',
54 'choices' => [
55 'config.form_settings.action_mark_as_read.redirect_homepage' => Config::REDIRECT_TO_HOMEPAGE,
56 'config.form_settings.action_mark_as_read.redirect_current_page' => Config::REDIRECT_TO_CURRENT_PAGE,
57 ],
58 ])
51 ->add('language', ChoiceType::class, [ 59 ->add('language', ChoiceType::class, [
52 'choices' => array_flip($this->languages), 60 'choices' => array_flip($this->languages),
53 'label' => 'config.form_settings.language_label', 61 'label' => 'config.form_settings.language_label',
diff --git a/src/Wallabag/CoreBundle/Helper/Redirect.php b/src/Wallabag/CoreBundle/Helper/Redirect.php
index c14c79d1..f78b7fe0 100644
--- a/src/Wallabag/CoreBundle/Helper/Redirect.php
+++ b/src/Wallabag/CoreBundle/Helper/Redirect.php
@@ -3,6 +3,8 @@
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\TokenStorageInterface;
7use Wallabag\CoreBundle\Entity\Config;
6 8
7/** 9/**
8 * Manage redirections to avoid redirecting to empty routes. 10 * Manage redirections to avoid redirecting to empty routes.
@@ -10,10 +12,12 @@ use Symfony\Component\Routing\Router;
10class Redirect 12class Redirect
11{ 13{
12 private $router; 14 private $router;
15 private $tokenStorage;
13 16
14 public function __construct(Router $router) 17 public function __construct(Router $router, TokenStorageInterface $tokenStorage)
15 { 18 {
16 $this->router = $router; 19 $this->router = $router;
20 $this->tokenStorage = $tokenStorage;
17 } 21 }
18 22
19 /** 23 /**
@@ -24,6 +28,16 @@ class Redirect
24 */ 28 */
25 public function to($url, $fallback = '') 29 public function to($url, $fallback = '')
26 { 30 {
31 $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
32
33 if (null === $user || !is_object($user)) {
34 return $url;
35 }
36
37 if (Config::REDIRECT_TO_HOMEPAGE === $user->getConfig()->getActionMarkAsRead()) {
38 return $this->router->generate('homepage');
39 }
40
27 if (null !== $url) { 41 if (null !== $url) {
28 return $url; 42 return $url;
29 } 43 }
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml
index 9786ac27..dad9bd42 100644
--- a/src/Wallabag/CoreBundle/Resources/config/services.yml
+++ b/src/Wallabag/CoreBundle/Resources/config/services.yml
@@ -109,6 +109,7 @@ services:
109 class: Wallabag\CoreBundle\Helper\Redirect 109 class: Wallabag\CoreBundle\Helper\Redirect
110 arguments: 110 arguments:
111 - "@router" 111 - "@router"
112 - "@security.token_storage"
112 113
113 wallabag_core.helper.prepare_pager_for_entries: 114 wallabag_core.helper.prepare_pager_for_entries:
114 class: Wallabag\CoreBundle\Helper\PreparePagerForEntries 115 class: Wallabag\CoreBundle\Helper\PreparePagerForEntries
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index b66aa3ea..c24c5965 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -70,6 +70,10 @@ config:
70 # 200_word: 'I read ~200 words per minute' 70 # 200_word: 'I read ~200 words per minute'
71 # 300_word: 'I read ~300 words per minute' 71 # 300_word: 'I read ~300 words per minute'
72 # 400_word: 'I read ~400 words per minute' 72 # 400_word: 'I read ~400 words per minute'
73 action_mark_as_read:
74 # label: 'Where do you to be redirected after mark an article as read?'
75 # redirect_homepage: 'To the homepage'
76 # redirect_current_page: 'To the current page'
73 pocket_consumer_key_label: Brugers nøgle til Pocket for at importere materialer 77 pocket_consumer_key_label: Brugers nøgle til Pocket for at importere materialer
74 # android_configuration: Configure your Android application 78 # android_configuration: Configure your Android application
75 form_rss: 79 form_rss:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index 9e19dcc4..561d276e 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -70,8 +70,12 @@ config:
70 200_word: 'Ich lese ~200 Wörter pro Minute' 70 200_word: 'Ich lese ~200 Wörter pro Minute'
71 300_word: 'Ich lese ~300 Wörter pro Minute' 71 300_word: 'Ich lese ~300 Wörter pro Minute'
72 400_word: 'Ich lese ~400 Wörter pro Minute' 72 400_word: 'Ich lese ~400 Wörter pro Minute'
73 action_mark_as_read:
74 label: 'Wohin soll nach dem Gelesenmarkieren eines Artikels weitergeleitet werden?'
75 redirect_homepage: 'Zur Homepage'
76 redirect_current_page: 'Zur aktuellen Seite'
73 pocket_consumer_key_label: Consumer-Key für Pocket, um Inhalte zu importieren 77 pocket_consumer_key_label: Consumer-Key für Pocket, um Inhalte zu importieren
74 # android_configuration: Configure your Android application 78 android_configuration: Konfiguriere deine Android Application
75 form_rss: 79 form_rss:
76 description: 'Die RSS-Feeds von wallabag erlauben es dir, deine gespeicherten Artikel mit deinem bevorzugten RSS-Reader zu lesen. Vorher musst du jedoch einen Token erstellen.' 80 description: 'Die RSS-Feeds von wallabag erlauben es dir, deine gespeicherten Artikel mit deinem bevorzugten RSS-Reader zu lesen. Vorher musst du jedoch einen Token erstellen.'
77 token_label: 'RSS-Token' 81 token_label: 'RSS-Token'
@@ -90,17 +94,17 @@ config:
90 email_label: 'E-Mail-Adresse' 94 email_label: 'E-Mail-Adresse'
91 twoFactorAuthentication_label: 'Zwei-Faktor-Authentifizierung' 95 twoFactorAuthentication_label: 'Zwei-Faktor-Authentifizierung'
92 delete: 96 delete:
93 # title: Delete my account (a.k.a danger zone) 97 title: Lösche mein Konto (a.k.a Gefahrenzone)
94 # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. 98 description: Wenn du dein Konto löschst, werden ALL deine Artikel, ALL deine Tags, ALL deine Anmerkungen und dein Konto dauerhaft gelöscht (kann NICHT RÜCKGÄNGIG gemacht werden). Du wirst anschließend ausgeloggt.
95 # confirm: Are you really sure? (THIS CAN'T BE UNDONE) 99 confirm: Bist du wirklich sicher? (DIES KANN NICHT RÜCKGÄNGIG GEMACHT WERDEN)
96 # button: Delete my account 100 button: Lösche mein Konto
97 reset: 101 reset:
98 # title: Reset area (a.k.a danger zone) 102 title: Zurücksetzen (a.k.a Gefahrenzone)
99 # description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE. 103 description: Beim Nutzen der folgenden Schaltflächenhast du die Möglichkeit, einige Informationen von deinem Konto zu entfernen. Sei dir bewusst, dass dies NICHT RÜCKGÄNGIG zu machen ist.
100 # annotations: Remove ALL annotations 104 annotations: Entferne ALLE Annotationen
101 # tags: Remove ALL tags 105 tags: Entferne ALLE Tags
102 # entries: Remove ALL entries 106 entries: Entferne ALLE Einträge
103 # confirm: Are you really really sure? (THIS CAN'T BE UNDONE) 107 confirm: Bist du wirklich sicher? (DIES KANN NICHT RÜCKGÄNGIG GEMACHT WERDEN)
104 form_password: 108 form_password:
105 old_password_label: 'Altes Kennwort' 109 old_password_label: 'Altes Kennwort'
106 new_password_label: 'Neues Kennwort' 110 new_password_label: 'Neues Kennwort'
@@ -371,7 +375,7 @@ import:
371 how_to: 'Bitte wähle deinen Readability Export aus und klicke den unteren Button für das Hochladen und Importieren dessen.' 375 how_to: 'Bitte wähle deinen Readability Export aus und klicke den unteren Button für das Hochladen und Importieren dessen.'
372 worker: 376 worker:
373 enabled: "Der Import erfolgt asynchron. Sobald der Import gestartet ist, wird diese Aufgabe extern abgearbeitet. Der aktuelle Service dafür ist:" 377 enabled: "Der Import erfolgt asynchron. Sobald der Import gestartet ist, wird diese Aufgabe extern abgearbeitet. Der aktuelle Service dafür ist:"
374 # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We <strong>strongly recommend</strong> to enable asynchronous import to avoid errors." 378 download_images_warning: "Du hast das Herunterladen von Bildern für deine Artikel aktiviert. Verbunden mit dem klassischen Import kann es ewig dauern fortzufahren (oder sogar fehlschlagen). Wir <strong>empfehlen</strong> den asynchronen Import zu aktivieren, um Fehler zu vermeiden."
375 firefox: 379 firefox:
376 page_title: 'Aus Firefox importieren' 380 page_title: 'Aus Firefox importieren'
377 description: "Dieser Import wird all deine Lesezeichen aus Firefox importieren. Gehe zu deinen Lesezeichen (Strg+Shift+O), dann auf \"Importen und Sichern\", wähle \"Sichern…\". Du erhälst eine .json Datei." 381 description: "Dieser Import wird all deine Lesezeichen aus Firefox importieren. Gehe zu deinen Lesezeichen (Strg+Shift+O), dann auf \"Importen und Sichern\", wähle \"Sichern…\". Du erhälst eine .json Datei."
@@ -467,7 +471,7 @@ user:
467 back_to_list: Zurück zur Liste 471 back_to_list: Zurück zur Liste
468 472
469error: 473error:
470 # page_title: An error occurred 474 page_title: Ein Fehler ist aufgetreten
471 475
472flashes: 476flashes:
473 config: 477 config:
@@ -480,9 +484,9 @@ flashes:
480 tagging_rules_updated: 'Tagging-Regeln aktualisiert' 484 tagging_rules_updated: 'Tagging-Regeln aktualisiert'
481 tagging_rules_deleted: 'Tagging-Regel gelöscht' 485 tagging_rules_deleted: 'Tagging-Regel gelöscht'
482 rss_token_updated: 'RSS-Token aktualisiert' 486 rss_token_updated: 'RSS-Token aktualisiert'
483 # annotations_reset: Annotations reset 487 annotations_reset: Anmerkungen zurücksetzen
484 # tags_reset: Tags reset 488 tags_reset: Tags zurücksetzen
485 # entries_reset: Entries reset 489 entries_reset: Einträge zurücksetzen
486 entry: 490 entry:
487 notice: 491 notice:
488 entry_already_saved: 'Eintrag bereits am %date% gespeichert' 492 entry_already_saved: 'Eintrag bereits am %date% gespeichert'
@@ -514,6 +518,6 @@ flashes:
514 client_deleted: 'Client gelöscht' 518 client_deleted: 'Client gelöscht'
515 user: 519 user:
516 notice: 520 notice:
517 # added: 'User "%username%" added' 521 added: 'Benutzer "%username%" hinzugefügt'
518 # updated: 'User "%username%" updated' 522 updated: 'Benutzer "%username%" aktualisiert'
519 # deleted: 'User "%username%" deleted' 523 deleted: 'Benutzer "%username%" gelöscht'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index 7516bbd5..ec49368c 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -70,6 +70,10 @@ config:
70 200_word: 'I read ~200 words per minute' 70 200_word: 'I read ~200 words per minute'
71 300_word: 'I read ~300 words per minute' 71 300_word: 'I read ~300 words per minute'
72 400_word: 'I read ~400 words per minute' 72 400_word: 'I read ~400 words per minute'
73 action_mark_as_read:
74 label: 'Where do you want to be redirected after mark an article as read?'
75 redirect_homepage: 'To the homepage'
76 redirect_current_page: 'To the current page'
73 pocket_consumer_key_label: Consumer key for Pocket to import contents 77 pocket_consumer_key_label: Consumer key for Pocket to import contents
74 android_configuration: Configure your Android application 78 android_configuration: Configure your Android application
75 form_rss: 79 form_rss:
@@ -96,11 +100,11 @@ config:
96 button: Delete my account 100 button: Delete my account
97 reset: 101 reset:
98 title: Reset area (a.k.a danger zone) 102 title: Reset area (a.k.a danger zone)
99 description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE. 103 description: By hitting buttons below you'll have ability to remove some information from your account. Be aware that these actions are IRREVERSIBLE.
100 annotations: Remove ALL annotations 104 annotations: Remove ALL annotations
101 tags: Remove ALL tags 105 tags: Remove ALL tags
102 entries: Remove ALL entries 106 entries: Remove ALL entries
103 confirm: Are you really really sure? (THIS CAN'T BE UNDONE) 107 confirm: Are you really sure? (THIS CAN'T BE UNDONE)
104 form_password: 108 form_password:
105 old_password_label: 'Current password' 109 old_password_label: 'Current password'
106 new_password_label: 'New password' 110 new_password_label: 'New password'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index 208982d9..15d0c3cf 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -70,6 +70,10 @@ config:
70 200_word: 'Leo ~200 palabras por minuto' 70 200_word: 'Leo ~200 palabras por minuto'
71 300_word: 'Leo ~300 palabras por minuto' 71 300_word: 'Leo ~300 palabras por minuto'
72 400_word: 'Leo ~400 palabras por minuto' 72 400_word: 'Leo ~400 palabras por minuto'
73 action_mark_as_read:
74 # label: 'Where do you to be redirected after mark an article as read?'
75 # redirect_homepage: 'To the homepage'
76 # redirect_current_page: 'To the current page'
73 # pocket_consumer_key_label: Consumer key for Pocket to import contents 77 # pocket_consumer_key_label: Consumer key for Pocket to import contents
74 # android_configuration: Configure your Android application 78 # android_configuration: Configure your Android application
75 form_rss: 79 form_rss:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index c443b21c..e7fa4f86 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -70,6 +70,10 @@ config:
70 200_word: 'من تقریباً ۲۰۰ واژه را در دقیقه می‌خوانم' 70 200_word: 'من تقریباً ۲۰۰ واژه را در دقیقه می‌خوانم'
71 300_word: 'من تقریباً ۳۰۰ واژه را در دقیقه می‌خوانم' 71 300_word: 'من تقریباً ۳۰۰ واژه را در دقیقه می‌خوانم'
72 400_word: 'من تقریباً ۴۰۰ واژه را در دقیقه می‌خوانم' 72 400_word: 'من تقریباً ۴۰۰ واژه را در دقیقه می‌خوانم'
73 action_mark_as_read:
74 # label: 'Where do you to be redirected after mark an article as read?'
75 # redirect_homepage: 'To the homepage'
76 # redirect_current_page: 'To the current page'
73 pocket_consumer_key_label: کلید کاربری Pocket برای درون‌ریزی مطالب 77 pocket_consumer_key_label: کلید کاربری Pocket برای درون‌ریزی مطالب
74 # android_configuration: Configure your Android application 78 # android_configuration: Configure your Android application
75 form_rss: 79 form_rss:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index ea759dd3..f85a797d 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -70,6 +70,10 @@ config:
70 200_word: "Je lis environ 200 mots par minute" 70 200_word: "Je lis environ 200 mots par minute"
71 300_word: "Je lis environ 300 mots par minute" 71 300_word: "Je lis environ 300 mots par minute"
72 400_word: "Je lis environ 400 mots par minute" 72 400_word: "Je lis environ 400 mots par minute"
73 action_mark_as_read:
74 label: 'Où souhaitez-vous être redirigé après avoir marqué un article comme lu ?'
75 redirect_homepage: "À la page d'accueil"
76 redirect_current_page: 'À la page courante'
73 pocket_consumer_key_label: Clé d’authentification Pocket pour importer les données 77 pocket_consumer_key_label: Clé d’authentification Pocket pour importer les données
74 android_configuration: Configurez votre application Android 78 android_configuration: Configurez votre application Android
75 form_rss: 79 form_rss:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index b3bc573b..8a8469d2 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -70,6 +70,10 @@ config:
70 200_word: 'Leggo ~200 parole al minuto' 70 200_word: 'Leggo ~200 parole al minuto'
71 300_word: 'Leggo ~300 parole al minuto' 71 300_word: 'Leggo ~300 parole al minuto'
72 400_word: 'Leggo ~400 parole al minuto' 72 400_word: 'Leggo ~400 parole al minuto'
73 action_mark_as_read:
74 # label: 'Where do you to be redirected after mark an article as read?'
75 # redirect_homepage: 'To the homepage'
76 # redirect_current_page: 'To the current page'
73 pocket_consumer_key_label: Consumer key per Pocket per importare i contenuti 77 pocket_consumer_key_label: Consumer key per Pocket per importare i contenuti
74 # android_configuration: Configure your Android application 78 # android_configuration: Configure your Android application
75 form_rss: 79 form_rss:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index 97b5f4a9..d37dc724 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -70,6 +70,10 @@ config:
70 200_word: "Legissi a l'entorn de 200 mots per minuta" 70 200_word: "Legissi a l'entorn de 200 mots per minuta"
71 300_word: "Legissi a l'entorn de 300 mots per minuta" 71 300_word: "Legissi a l'entorn de 300 mots per minuta"
72 400_word: "Legissi a l'entorn de 400 mots per minuta" 72 400_word: "Legissi a l'entorn de 400 mots per minuta"
73 action_mark_as_read:
74 # label: 'Where do you to be redirected after mark an article as read?'
75 # redirect_homepage: 'To the homepage'
76 # redirect_current_page: 'To the current page'
73 pocket_consumer_key_label: Clau d'autentificacion Pocket per importar las donadas 77 pocket_consumer_key_label: Clau d'autentificacion Pocket per importar las donadas
74 android_configuration: Configuratz vòstra aplicacion Android 78 android_configuration: Configuratz vòstra aplicacion Android
75 form_rss: 79 form_rss:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index b4212b83..117a1e12 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -70,6 +70,10 @@ config:
70 200_word: 'Czytam ~200 słów na minutę' 70 200_word: 'Czytam ~200 słów na minutę'
71 300_word: 'Czytam ~300 słów na minutę' 71 300_word: 'Czytam ~300 słów na minutę'
72 400_word: 'Czytam ~400 słów na minutę' 72 400_word: 'Czytam ~400 słów na minutę'
73 action_mark_as_read:
74 # label: 'Where do you to be redirected after mark an article as read?'
75 # redirect_homepage: 'To the homepage'
76 # redirect_current_page: 'To the current page'
73 pocket_consumer_key_label: 'Klucz klienta Pocket do importu zawartości' 77 pocket_consumer_key_label: 'Klucz klienta Pocket do importu zawartości'
74 android_configuration: Skonfiguruj swoją androidową aplikację 78 android_configuration: Skonfiguruj swoją androidową aplikację
75 form_rss: 79 form_rss:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
index d8fc9d5c..5d2607af 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
@@ -70,6 +70,10 @@ config:
70 200_word: 'Posso ler ~200 palavras por minuto' 70 200_word: 'Posso ler ~200 palavras por minuto'
71 300_word: 'Posso ler ~300 palavras por minuto' 71 300_word: 'Posso ler ~300 palavras por minuto'
72 400_word: 'Posso ler ~400 palavras por minuto' 72 400_word: 'Posso ler ~400 palavras por minuto'
73 action_mark_as_read:
74 # label: 'Where do you to be redirected after mark an article as read?'
75 # redirect_homepage: 'To the homepage'
76 # redirect_current_page: 'To the current page'
73 pocket_consumer_key_label: 'Chave do consumidor do Pocket para importar conteúdo' 77 pocket_consumer_key_label: 'Chave do consumidor do Pocket para importar conteúdo'
74 # android_configuration: Configure your Android application 78 # android_configuration: Configure your Android application
75 form_rss: 79 form_rss:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index d130e431..6b51d9ce 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -70,6 +70,10 @@ config:
70 # 200_word: 'I read ~200 words per minute' 70 # 200_word: 'I read ~200 words per minute'
71 # 300_word: 'I read ~300 words per minute' 71 # 300_word: 'I read ~300 words per minute'
72 # 400_word: 'I read ~400 words per minute' 72 # 400_word: 'I read ~400 words per minute'
73 action_mark_as_read:
74 # label: 'Where do you to be redirected after mark an article as read?'
75 # redirect_homepage: 'To the homepage'
76 # redirect_current_page: 'To the current page'
73 pocket_consumer_key_label: Cheie consumator pentru importarea contentului din Pocket 77 pocket_consumer_key_label: Cheie consumator pentru importarea contentului din Pocket
74 # android_configuration: Configure your Android application 78 # android_configuration: Configure your Android application
75 form_rss: 79 form_rss:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index f67d8bee..9c392433 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -70,6 +70,10 @@ config:
70 # 200_word: 'I read ~200 words per minute' 70 # 200_word: 'I read ~200 words per minute'
71 # 300_word: 'I read ~300 words per minute' 71 # 300_word: 'I read ~300 words per minute'
72 # 400_word: 'I read ~400 words per minute' 72 # 400_word: 'I read ~400 words per minute'
73 action_mark_as_read:
74 # label: 'Where do you to be redirected after mark an article as read?'
75 # redirect_homepage: 'To the homepage'
76 # redirect_current_page: 'To the current page'
73 # pocket_consumer_key_label: Consumer key for Pocket to import contents 77 # pocket_consumer_key_label: Consumer key for Pocket to import contents
74 # android_configuration: Configure your Android application 78 # android_configuration: Configure your Android application
75 form_rss: 79 form_rss:
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig
index ec3b23c8..4c01b128 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig
@@ -38,6 +38,14 @@
38 38
39 <fieldset class="w500p inline"> 39 <fieldset class="w500p inline">
40 <div class="row"> 40 <div class="row">
41 {{ form_label(form.config.action_mark_as_read) }}
42 {{ form_errors(form.config.action_mark_as_read) }}
43 {{ form_widget(form.config.action_mark_as_read) }}
44 </div>
45 </fieldset>
46
47 <fieldset class="w500p inline">
48 <div class="row">
41 {{ form_label(form.config.language) }} 49 {{ form_label(form.config.language) }}
42 {{ form_errors(form.config.language) }} 50 {{ form_errors(form.config.language) }}
43 {{ form_widget(form.config.language) }} 51 {{ form_widget(form.config.language) }}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
index f69d158f..e774795b 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
@@ -51,6 +51,14 @@
51 </div> 51 </div>
52 </div> 52 </div>
53 53
54 <div class="row">
55 <div class="input-field col s12">
56 {{ form_label(form.config.action_mark_as_read) }}
57 {{ form_errors(form.config.action_mark_as_read) }}
58 {{ form_widget(form.config.action_mark_as_read) }}
59 </div>
60 </div>
61
54 <div class="row"> 62 <div class="row">
55 <div class="input-field col s12"> 63 <div class="input-field col s12">
56 {{ form_label(form.config.language) }} 64 {{ form_label(form.config.language) }}
diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
index 568576a3..a2863014 100644
--- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
@@ -51,6 +51,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
51 'config[theme]' => 'baggy', 51 'config[theme]' => 'baggy',
52 'config[items_per_page]' => '30', 52 'config[items_per_page]' => '30',
53 'config[reading_speed]' => '0.5', 53 'config[reading_speed]' => '0.5',
54 'config[action_mark_as_read]' => '0',
54 'config[language]' => 'en', 55 'config[language]' => 'en',
55 ]; 56 ];
56 57
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 4ab06dbf..bf4e0543 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -3,6 +3,7 @@
3namespace Tests\Wallabag\CoreBundle\Controller; 3namespace Tests\Wallabag\CoreBundle\Controller;
4 4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; 5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6use Wallabag\CoreBundle\Entity\Config;
6use Wallabag\CoreBundle\Entity\Entry; 7use Wallabag\CoreBundle\Entity\Entry;
7 8
8class EntryControllerTest extends WallabagCoreTestCase 9class EntryControllerTest extends WallabagCoreTestCase
@@ -896,4 +897,68 @@ class EntryControllerTest extends WallabagCoreTestCase
896 897
897 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); 898 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0);
898 } 899 }
900
901 public function testRedirectToHomepage()
902 {
903 $this->logInAs('empty');
904 $client = $this->getClient();
905
906 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
907 $user = $em
908 ->getRepository('WallabagUserBundle:User')
909 ->find($this->getLoggedInUserId());
910
911 if (!$user) {
912 $this->markTestSkipped('No user found in db.');
913 }
914
915 // Redirect to homepage
916 $config = $user->getConfig();
917 $config->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE);
918 $em->persist($config);
919 $em->flush();
920
921 $content = $client->getContainer()
922 ->get('doctrine.orm.entity_manager')
923 ->getRepository('WallabagCoreBundle:Entry')
924 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
925
926 $client->request('GET', '/view/'.$content->getId());
927 $client->request('GET', '/archive/'.$content->getId());
928
929 $this->assertEquals(302, $client->getResponse()->getStatusCode());
930 $this->assertEquals('/', $client->getResponse()->headers->get('location'));
931 }
932
933 public function testRedirectToCurrentPage()
934 {
935 $this->logInAs('empty');
936 $client = $this->getClient();
937
938 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
939 $user = $em
940 ->getRepository('WallabagUserBundle:User')
941 ->find($this->getLoggedInUserId());
942
943 if (!$user) {
944 $this->markTestSkipped('No user found in db.');
945 }
946
947 // Redirect to current page
948 $config = $user->getConfig();
949 $config->setActionMarkAsRead(Config::REDIRECT_TO_CURRENT_PAGE);
950 $em->persist($config);
951 $em->flush();
952
953 $content = $client->getContainer()
954 ->get('doctrine.orm.entity_manager')
955 ->getRepository('WallabagCoreBundle:Entry')
956 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
957
958 $client->request('GET', '/view/'.$content->getId());
959 $client->request('GET', '/archive/'.$content->getId());
960
961 $this->assertEquals(302, $client->getResponse()->getStatusCode());
962 $this->assertContains('/view/'.$content->getId(), $client->getResponse()->headers->get('location'));
963 }
899} 964}
diff --git a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
index 920c21d9..85f12d87 100644
--- a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
@@ -3,7 +3,6 @@
3namespace Tests\Wallabag\CoreBundle\Helper; 3namespace Tests\Wallabag\CoreBundle\Helper;
4 4
5use Wallabag\CoreBundle\Helper\DownloadImages; 5use Wallabag\CoreBundle\Helper\DownloadImages;
6use Psr\Log\NullLogger;
7use Monolog\Logger; 6use Monolog\Logger;
8use Monolog\Handler\TestHandler; 7use Monolog\Handler\TestHandler;
9use GuzzleHttp\Client; 8use GuzzleHttp\Client;
diff --git a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php
index f339f75e..0539f20a 100644
--- a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php
@@ -2,7 +2,11 @@
2 2
3namespace Tests\Wallabag\CoreBundle\Helper; 3namespace Tests\Wallabag\CoreBundle\Helper;
4 4
5use Wallabag\CoreBundle\Entity\Config;
6use Wallabag\UserBundle\Entity\User;
5use Wallabag\CoreBundle\Helper\Redirect; 7use Wallabag\CoreBundle\Helper\Redirect;
8use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
9use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
6 10
7class RedirectTest extends \PHPUnit_Framework_TestCase 11class RedirectTest extends \PHPUnit_Framework_TestCase
8{ 12{
@@ -14,8 +18,38 @@ class RedirectTest extends \PHPUnit_Framework_TestCase
14 18
15 public function setUp() 19 public function setUp()
16 { 20 {
17 $this->routerMock = $this->getRouterMock(); 21 $this->routerMock = $this->getMockBuilder('Symfony\Component\Routing\Router')
18 $this->redirect = new Redirect($this->routerMock); 22 ->disableOriginalConstructor()
23 ->getMock();
24
25 $this->routerMock->expects($this->any())
26 ->method('generate')
27 ->with('homepage')
28 ->willReturn('homepage');
29
30 $user = new User();
31 $user->setName('youpi');
32 $user->setEmail('youpi@youpi.org');
33 $user->setUsername('youpi');
34 $user->setPlainPassword('youpi');
35 $user->setEnabled(true);
36 $user->addRole('ROLE_SUPER_ADMIN');
37
38 $config = new Config($user);
39 $config->setTheme('material');
40 $config->setItemsPerPage(30);
41 $config->setReadingSpeed(1);
42 $config->setLanguage('en');
43 $config->setPocketConsumerKey('xxxxx');
44 $config->setActionMarkAsRead(Config::REDIRECT_TO_CURRENT_PAGE);
45
46 $user->setConfig($config);
47
48 $this->token = new UsernamePasswordToken($user, 'password', 'key');
49 $tokenStorage = new TokenStorage();
50 $tokenStorage->setToken($this->token);
51
52 $this->redirect = new Redirect($this->routerMock, $tokenStorage);
19 } 53 }
20 54
21 public function testRedirectToNullWithFallback() 55 public function testRedirectToNullWithFallback()
@@ -39,17 +73,20 @@ class RedirectTest extends \PHPUnit_Framework_TestCase
39 $this->assertEquals('/unread/list', $redirectUrl); 73 $this->assertEquals('/unread/list', $redirectUrl);
40 } 74 }
41 75
42 private function getRouterMock() 76 public function testWithNotLoggedUser()
43 { 77 {
44 $mock = $this->getMockBuilder('Symfony\Component\Routing\Router') 78 $redirect = new Redirect($this->routerMock, new TokenStorage());
45 ->disableOriginalConstructor() 79 $redirectUrl = $redirect->to('/unread/list');
46 ->getMock();
47 80
48 $mock->expects($this->any()) 81 $this->assertEquals('/unread/list', $redirectUrl);
49 ->method('generate') 82 }
50 ->with('homepage')
51 ->willReturn('homepage');
52 83
53 return $mock; 84 public function testUserForRedirectToHomepage()
85 {
86 $this->token->getUser()->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE);
87
88 $redirectUrl = $this->redirect->to('/unread/list');
89
90 $this->assertEquals($this->routerMock->generate('homepage'), $redirectUrl);
54 } 91 }
55} 92}