aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-12-12 22:54:43 +0100
committerGitHub <noreply@github.com>2016-12-12 22:54:43 +0100
commit375c9e2d3eddebf168e078f4dec7608a3c34245c (patch)
tree9caa9e59d581ea0be79193635683bac5f1065438
parent2c1eed8051160499d40ed033c83dd003c81b371e (diff)
parent24879db1f73c85b121702ba8c6ea36bae285c7c3 (diff)
downloadwallabag-375c9e2d3eddebf168e078f4dec7608a3c34245c.tar.gz
wallabag-375c9e2d3eddebf168e078f4dec7608a3c34245c.tar.zst
wallabag-375c9e2d3eddebf168e078f4dec7608a3c34245c.zip
Merge pull request #2697 from wallabag/fix-list-mode
Add default value for list_mode
-rw-r--r--app/DoctrineMigrations/Version20161128084725.php2
-rw-r--r--app/config/config.yml2
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php3
-rw-r--r--src/Wallabag/CoreBundle/DependencyInjection/Configuration.php6
-rw-r--r--src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php2
-rw-r--r--src/Wallabag/UserBundle/EventListener/CreateConfigListener.php8
-rw-r--r--src/Wallabag/UserBundle/Resources/config/services.yml2
-rw-r--r--tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php2
8 files changed, 25 insertions, 2 deletions
diff --git a/app/DoctrineMigrations/Version20161128084725.php b/app/DoctrineMigrations/Version20161128084725.php
index 242d5900..ea370076 100644
--- a/app/DoctrineMigrations/Version20161128084725.php
+++ b/app/DoctrineMigrations/Version20161128084725.php
@@ -35,7 +35,7 @@ class Version20161128084725 extends AbstractMigration implements ContainerAwareI
35 $configTable = $schema->getTable($this->getTable('config')); 35 $configTable = $schema->getTable($this->getTable('config'));
36 $this->skipIf($configTable->hasColumn('list_mode'), 'It seems that you already played this migration.'); 36 $this->skipIf($configTable->hasColumn('list_mode'), 'It seems that you already played this migration.');
37 37
38 $configTable->addColumn('list_mode', 'integer'); 38 $configTable->addColumn('list_mode', 'integer', ['notnull' => false]);
39 } 39 }
40 40
41 /** 41 /**
diff --git a/app/config/config.yml b/app/config/config.yml
index 6b1ed056..d52f37c8 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -51,6 +51,8 @@ wallabag_core:
51 rss_limit: 50 51 rss_limit: 50
52 reading_speed: 1 52 reading_speed: 1
53 cache_lifetime: 10 53 cache_lifetime: 10
54 action_mark_as_read: 1
55 list_mode: 1
54 fetching_error_message: | 56 fetching_error_message: |
55 wallabag can't retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/master/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>. 57 wallabag can't retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/master/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>.
56 58
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
index 45358022..3d4d5def 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
@@ -22,6 +22,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
22 $adminConfig->setLanguage('en'); 22 $adminConfig->setLanguage('en');
23 $adminConfig->setPocketConsumerKey('xxxxx'); 23 $adminConfig->setPocketConsumerKey('xxxxx');
24 $adminConfig->setActionMarkAsRead(0); 24 $adminConfig->setActionMarkAsRead(0);
25 $adminConfig->setListMode(0);
25 26
26 $manager->persist($adminConfig); 27 $manager->persist($adminConfig);
27 28
@@ -34,6 +35,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
34 $bobConfig->setLanguage('fr'); 35 $bobConfig->setLanguage('fr');
35 $bobConfig->setPocketConsumerKey(null); 36 $bobConfig->setPocketConsumerKey(null);
36 $bobConfig->setActionMarkAsRead(1); 37 $bobConfig->setActionMarkAsRead(1);
38 $bobConfig->setListMode(1);
37 39
38 $manager->persist($bobConfig); 40 $manager->persist($bobConfig);
39 41
@@ -46,6 +48,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
46 $emptyConfig->setLanguage('en'); 48 $emptyConfig->setLanguage('en');
47 $emptyConfig->setPocketConsumerKey(null); 49 $emptyConfig->setPocketConsumerKey(null);
48 $emptyConfig->setActionMarkAsRead(0); 50 $emptyConfig->setActionMarkAsRead(0);
51 $emptyConfig->setListMode(0);
49 52
50 $manager->persist($emptyConfig); 53 $manager->persist($emptyConfig);
51 54
diff --git a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php
index 3a3da024..006a18c3 100644
--- a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php
+++ b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php
@@ -41,6 +41,12 @@ class Configuration implements ConfigurationInterface
41 ->end() 41 ->end()
42 ->scalarNode('fetching_error_message') 42 ->scalarNode('fetching_error_message')
43 ->end() 43 ->end()
44 ->scalarNode('action_mark_as_read')
45 ->defaultValue(1)
46 ->end()
47 ->scalarNode('list_mode')
48 ->defaultValue(1)
49 ->end()
44 ->end() 50 ->end()
45 ; 51 ;
46 52
diff --git a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php
index b4992d54..aa9ee339 100644
--- a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php
+++ b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php
@@ -23,6 +23,8 @@ class WallabagCoreExtension extends Extension
23 $container->setParameter('wallabag_core.version', $config['version']); 23 $container->setParameter('wallabag_core.version', $config['version']);
24 $container->setParameter('wallabag_core.paypal_url', $config['paypal_url']); 24 $container->setParameter('wallabag_core.paypal_url', $config['paypal_url']);
25 $container->setParameter('wallabag_core.cache_lifetime', $config['cache_lifetime']); 25 $container->setParameter('wallabag_core.cache_lifetime', $config['cache_lifetime']);
26 $container->setParameter('wallabag_core.action_mark_as_read', $config['action_mark_as_read']);
27 $container->setParameter('wallabag_core.list_mode', $config['list_mode']);
26 $container->setParameter('wallabag_core.fetching_error_message', $config['fetching_error_message']); 28 $container->setParameter('wallabag_core.fetching_error_message', $config['fetching_error_message']);
27 29
28 $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); 30 $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
diff --git a/src/Wallabag/UserBundle/EventListener/CreateConfigListener.php b/src/Wallabag/UserBundle/EventListener/CreateConfigListener.php
index 8e2f04e9..0bdd1cae 100644
--- a/src/Wallabag/UserBundle/EventListener/CreateConfigListener.php
+++ b/src/Wallabag/UserBundle/EventListener/CreateConfigListener.php
@@ -21,8 +21,10 @@ class CreateConfigListener implements EventSubscriberInterface
21 private $rssLimit; 21 private $rssLimit;
22 private $language; 22 private $language;
23 private $readingSpeed; 23 private $readingSpeed;
24 private $actionMarkAsRead;
25 private $listMode;
24 26
25 public function __construct(EntityManager $em, $theme, $itemsOnPage, $rssLimit, $language, $readingSpeed) 27 public function __construct(EntityManager $em, $theme, $itemsOnPage, $rssLimit, $language, $readingSpeed, $actionMarkAsRead, $listMode)
26 { 28 {
27 $this->em = $em; 29 $this->em = $em;
28 $this->theme = $theme; 30 $this->theme = $theme;
@@ -30,6 +32,8 @@ class CreateConfigListener implements EventSubscriberInterface
30 $this->rssLimit = $rssLimit; 32 $this->rssLimit = $rssLimit;
31 $this->language = $language; 33 $this->language = $language;
32 $this->readingSpeed = $readingSpeed; 34 $this->readingSpeed = $readingSpeed;
35 $this->actionMarkAsRead = $actionMarkAsRead;
36 $this->listMode = $listMode;
33 } 37 }
34 38
35 public static function getSubscribedEvents() 39 public static function getSubscribedEvents()
@@ -51,6 +55,8 @@ class CreateConfigListener implements EventSubscriberInterface
51 $config->setRssLimit($this->rssLimit); 55 $config->setRssLimit($this->rssLimit);
52 $config->setLanguage($this->language); 56 $config->setLanguage($this->language);
53 $config->setReadingSpeed($this->readingSpeed); 57 $config->setReadingSpeed($this->readingSpeed);
58 $config->setActionMarkAsRead($this->actionMarkAsRead);
59 $config->setListMode($this->listMode);
54 60
55 $this->em->persist($config); 61 $this->em->persist($config);
56 $this->em->flush(); 62 $this->em->flush();
diff --git a/src/Wallabag/UserBundle/Resources/config/services.yml b/src/Wallabag/UserBundle/Resources/config/services.yml
index 164a25ec..72f6f12c 100644
--- a/src/Wallabag/UserBundle/Resources/config/services.yml
+++ b/src/Wallabag/UserBundle/Resources/config/services.yml
@@ -31,5 +31,7 @@ services:
31 - "%wallabag_core.rss_limit%" 31 - "%wallabag_core.rss_limit%"
32 - "%wallabag_core.language%" 32 - "%wallabag_core.language%"
33 - "%wallabag_core.reading_speed%" 33 - "%wallabag_core.reading_speed%"
34 - "%wallabag_core.action_mark_as_read%"
35 - "%wallabag_core.list_mode%"
34 tags: 36 tags:
35 - { name: kernel.event_subscriber } 37 - { name: kernel.event_subscriber }
diff --git a/tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php b/tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php
index a78b77bc..01796ded 100644
--- a/tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php
+++ b/tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php
@@ -31,6 +31,8 @@ class CreateConfigListenerTest extends \PHPUnit_Framework_TestCase
31 20, 31 20,
32 50, 32 50,
33 'fr', 33 'fr',
34 1,
35 1,
34 1 36 1
35 ); 37 );
36 38