]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Create config even if user is disabled
authorJeremy Benoist <jeremy.benoist@gmail.com>
Tue, 4 Oct 2016 08:42:45 +0000 (10:42 +0200)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Tue, 4 Oct 2016 08:42:46 +0000 (10:42 +0200)
When a user register itself AND the wallabag instance is configured to send a confirmation email, the user is disabled when the listener (which create the config) receive the event.
There were a check (don't know why) if the user is enabled we create the config. But the user is disabled when confirmation email is actived.

src/Wallabag/UserBundle/EventListener/CreateConfigListener.php
tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php

index 15f4ac3dee41faad596d6b56484d3cc1858b6e41..8e2f04e9beca05428dc5c0c4d698e0ddb85252c2 100644 (file)
@@ -45,10 +45,6 @@ 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);
index 0cebd3e43731a23dba09040ab0b984a9574e75f1..a78b77bc37c332c628e7b405732a3339413899db 100644 (file)
@@ -41,26 +41,6 @@ class CreateConfigListenerTest extends \PHPUnit_Framework_TestCase
         $this->response = Response::create();
     }
 
-    public function testWithInvalidUser()
-    {
-        $user = new User();
-        $user->setEnabled(false);
-
-        $event = new FilterUserResponseEvent(
-            $user,
-            $this->request,
-            $this->response
-        );
-
-        $this->em->expects($this->never())->method('persist');
-        $this->em->expects($this->never())->method('flush');
-
-        $this->dispatcher->dispatch(
-            FOSUserEvents::REGISTRATION_COMPLETED,
-            $event
-        );
-    }
-
     public function testWithValidUser()
     {
         $user = new User();