]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/UserBundle/EventListener/CreateConfigListener.php
Merge pull request #2878 from matteocoder/wallabag-docs-ita
[github/wallabag/wallabag.git] / src / Wallabag / UserBundle / EventListener / CreateConfigListener.php
index 15f4ac3dee41faad596d6b56484d3cc1858b6e41..0bdd1cae061d365a751911de1fc73f5f34c34e00 100644 (file)
@@ -21,8 +21,10 @@ class CreateConfigListener implements EventSubscriberInterface
     private $rssLimit;
     private $language;
     private $readingSpeed;
+    private $actionMarkAsRead;
+    private $listMode;
 
-    public function __construct(EntityManager $em, $theme, $itemsOnPage, $rssLimit, $language, $readingSpeed)
+    public function __construct(EntityManager $em, $theme, $itemsOnPage, $rssLimit, $language, $readingSpeed, $actionMarkAsRead, $listMode)
     {
         $this->em = $em;
         $this->theme = $theme;
@@ -30,6 +32,8 @@ class CreateConfigListener implements EventSubscriberInterface
         $this->rssLimit = $rssLimit;
         $this->language = $language;
         $this->readingSpeed = $readingSpeed;
+        $this->actionMarkAsRead = $actionMarkAsRead;
+        $this->listMode = $listMode;
     }
 
     public static function getSubscribedEvents()
@@ -45,16 +49,14 @@ class CreateConfigListener implements EventSubscriberInterface
 
     public function createConfig(UserEvent $event, $eventName = null, EventDispatcherInterface $eventDispatcher = null)
     {
-        if (!$event->getUser()->isEnabled()) {
-            return;
-        }
-
         $config = new Config($event->getUser());
         $config->setTheme($this->theme);
         $config->setItemsPerPage($this->itemsOnPage);
         $config->setRssLimit($this->rssLimit);
         $config->setLanguage($this->language);
         $config->setReadingSpeed($this->readingSpeed);
+        $config->setActionMarkAsRead($this->actionMarkAsRead);
+        $config->setListMode($this->listMode);
 
         $this->em->persist($config);
         $this->em->flush();