From e4b46f77ef2984b33f4dff0efea0585c7ab0cfbf Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sun, 26 Jun 2016 13:36:53 +0200 Subject: work --- .../CoreBundle/Controller/ConfigController.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 91cdcae5..0a306d57 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -251,4 +251,24 @@ class ConfigController extends Controller return $config; } + + /** + * Delete account for current user. + * + * @Route("/account/delete", name="delete_account") + * + * @return \Symfony\Component\HttpFoundation\RedirectResponse + */ + public function deleteAccountAction() + { + $em = $this->get('fos_user.user_manager'); + $em->deleteUser($this->getUser()); + + $this->get('session')->getFlashBag()->add( + 'notice', + 'flashes.account.notice.account_deleted' + ); + + return $this->redirect($this->generateUrl('fos_user_security_logout')); + } } -- cgit v1.2.3 From abb5291cd5dc98211273e5d3b516a6a0ed8b980f Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 1 Jul 2016 10:58:15 +0200 Subject: CS --- src/Wallabag/CoreBundle/Controller/ConfigController.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 0a306d57..3cafd1bc 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -252,13 +252,13 @@ class ConfigController extends Controller return $config; } - /** - * Delete account for current user. - * - * @Route("/account/delete", name="delete_account") - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse - */ + /** + * Delete account for current user. + * + * @Route("/account/delete", name="delete_account") + * + * @return \Symfony\Component\HttpFoundation\RedirectResponse + */ public function deleteAccountAction() { $em = $this->get('fos_user.user_manager'); -- cgit v1.2.3 From bb0c78f4a636fcc8f60dd3b42ad733e7f31e0bb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 8 Sep 2016 14:07:36 +0200 Subject: Added check if there is only one user Added translations and documentation --- src/Wallabag/CoreBundle/Controller/ConfigController.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 3cafd1bc..70a641f7 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -7,6 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Wallabag\CoreBundle\Entity\Config; use Wallabag\CoreBundle\Entity\TaggingRule; use Wallabag\CoreBundle\Form\Type\ConfigType; @@ -148,6 +149,9 @@ class ConfigController extends Controller 'token' => $config->getRssToken(), ], 'twofactor_auth' => $this->getParameter('twofactor_auth'), + 'enabled_users' => $this->getDoctrine() + ->getRepository('WallabagUserBundle:User') + ->getSumEnabledUsers(), ]); } @@ -257,10 +261,20 @@ class ConfigController extends Controller * * @Route("/account/delete", name="delete_account") * + * @throws AccessDeniedHttpException + * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function deleteAccountAction() { + $enabledUsers = $this->getDoctrine() + ->getRepository('WallabagUserBundle:User') + ->getSumEnabledUsers(); + + if ($enabledUsers <= 1) { + throw new AccessDeniedHttpException(); + } + $em = $this->get('fos_user.user_manager'); $em->deleteUser($this->getUser()); -- cgit v1.2.3 From eed812afd0626697d33f7e9d3bfd8eca138c463d Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 8 Oct 2016 19:39:12 +0200 Subject: Logout user before deleting it And add a smal description --- .../CoreBundle/Controller/ConfigController.php | 43 ++++++++++++---------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 70a641f7..662da2a0 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -261,28 +261,31 @@ class ConfigController extends Controller * * @Route("/account/delete", name="delete_account") * + * @param Request $request + * * @throws AccessDeniedHttpException * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ - public function deleteAccountAction() - { - $enabledUsers = $this->getDoctrine() - ->getRepository('WallabagUserBundle:User') - ->getSumEnabledUsers(); - - if ($enabledUsers <= 1) { - throw new AccessDeniedHttpException(); - } - - $em = $this->get('fos_user.user_manager'); - $em->deleteUser($this->getUser()); - - $this->get('session')->getFlashBag()->add( - 'notice', - 'flashes.account.notice.account_deleted' - ); - - return $this->redirect($this->generateUrl('fos_user_security_logout')); - } + public function deleteAccountAction(Request $request) + { + $enabledUsers = $this->getDoctrine() + ->getRepository('WallabagUserBundle:User') + ->getSumEnabledUsers(); + + if ($enabledUsers <= 1) { + throw new AccessDeniedHttpException(); + } + + $user = $this->getUser(); + + // logout current user + $this->get('security.token_storage')->setToken(null); + $request->getSession()->invalidate(); + + $em = $this->get('fos_user.user_manager'); + $em->deleteUser($user); + + return $this->redirect($this->generateUrl('fos_user_security_login')); + } } -- cgit v1.2.3 From 7ac3e575f1285a07987346461cee9445ac8c0b3b Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 8 Oct 2016 20:35:16 +0200 Subject: CS --- .../CoreBundle/Controller/ConfigController.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 662da2a0..abd35c02 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -256,17 +256,17 @@ class ConfigController extends Controller return $config; } - /** - * Delete account for current user. - * - * @Route("/account/delete", name="delete_account") - * - * @param Request $request - * - * @throws AccessDeniedHttpException - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse - */ + /** + * Delete account for current user. + * + * @Route("/account/delete", name="delete_account") + * + * @param Request $request + * + * @throws AccessDeniedHttpException + * + * @return \Symfony\Component\HttpFoundation\RedirectResponse + */ public function deleteAccountAction(Request $request) { $enabledUsers = $this->getDoctrine() -- cgit v1.2.3 From 206bade58a279d7f2e34c2dbada10366b90d2d6b Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 1 Oct 2016 09:26:32 +0200 Subject: Add ability to reset some datas - annotations - tags - entries --- .../CoreBundle/Controller/ConfigController.php | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index abd35c02..ccbf550a 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -224,6 +224,48 @@ class ConfigController extends Controller return $this->redirect($this->generateUrl('config').'?tagging-rule='.$rule->getId().'#set5'); } + /** + * Remove all annotations OR tags OR entries for the current user. + * + * @Route("/reset/{type}", requirements={"id" = "annotations|tags|entries"}, name="config_reset") + * + * @return RedirectResponse + */ + public function resetAction($type) + { + $em = $this->getDoctrine()->getManager(); + + switch ($type) { + case 'annotations': + $em->createQuery('DELETE FROM Wallabag\AnnotationBundle\Entity\Annotation a WHERE a.user = '.$this->getUser()->getId()) + ->execute(); + break; + + case 'tags': + $tags = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findAllTags($this->getUser()->getId()); + + if (empty($tags)) { + break; + } + + $this->getDoctrine() + ->getRepository('WallabagCoreBundle:Entry') + ->removeTags($this->getUser()->getId(), $tags); + break; + + case 'entries': + $em->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.user = '.$this->getUser()->getId()) + ->execute(); + } + + $this->get('session')->getFlashBag()->add( + 'notice', + 'flashes.config.notice.'.$type.'_reset' + ); + + return $this->redirect($this->generateUrl('config').'#set3'); + } + /** * Validate that a rule can be edited/deleted by the current user. * -- cgit v1.2.3 From 191564b7f71d01fb4c597c9b9641e23db564278d Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 1 Oct 2016 14:01:13 +0200 Subject: Add custom doctrine subscriber for SQLite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since SQLite doesn’t handle cascade remove by default, we need to handle it manually. Also some refacto --- .../CoreBundle/Controller/ConfigController.php | 41 ++++++++++++++++------ 1 file changed, 30 insertions(+), 11 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index ccbf550a..faa85d16 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -237,25 +237,26 @@ class ConfigController extends Controller switch ($type) { case 'annotations': - $em->createQuery('DELETE FROM Wallabag\AnnotationBundle\Entity\Annotation a WHERE a.user = '.$this->getUser()->getId()) - ->execute(); + $this->getDoctrine() + ->getRepository('WallabagAnnotationBundle:Annotation') + ->removeAllByUserId($this->getUser()->getId()); break; case 'tags': - $tags = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findAllTags($this->getUser()->getId()); + $this->removeAllTagsByUserId($this->getUser()->getId()); + break; - if (empty($tags)) { - break; + case 'entries': + // SQLite doesn't care about cascading remove, so we need to manually remove associated stuf + // otherwise they won't be removed ... + if ($this->get('doctrine')->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) { + $this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->removeAllByUserId($this->getUser()->getId()); + $this->removeAllTagsByUserId($this->getUser()->getId()); } $this->getDoctrine() ->getRepository('WallabagCoreBundle:Entry') - ->removeTags($this->getUser()->getId(), $tags); - break; - - case 'entries': - $em->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.user = '.$this->getUser()->getId()) - ->execute(); + ->removeAllByUserId($this->getUser()->getId()); } $this->get('session')->getFlashBag()->add( @@ -266,6 +267,24 @@ class ConfigController extends Controller return $this->redirect($this->generateUrl('config').'#set3'); } + /** + * Remove all tags for a given user. + * + * @param int $userId + */ + private function removeAllTagsByUserId($userId) + { + $tags = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findAllTags($userId); + + if (empty($tags)) { + return; + } + + $this->getDoctrine() + ->getRepository('WallabagCoreBundle:Entry') + ->removeTags($userId, $tags); + } + /** * Validate that a rule can be edited/deleted by the current user. * -- cgit v1.2.3 From f71e55ac886a26813ca1171c0aca4921aa8f00ad Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 8 Oct 2016 11:05:03 +0200 Subject: Avoid orphan tags --- src/Wallabag/CoreBundle/Controller/ConfigController.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index faa85d16..e2484064 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -251,9 +251,11 @@ class ConfigController extends Controller // otherwise they won't be removed ... if ($this->get('doctrine')->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) { $this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->removeAllByUserId($this->getUser()->getId()); - $this->removeAllTagsByUserId($this->getUser()->getId()); } + // manually remove tags first to avoid orphan tag + $this->removeAllTagsByUserId($this->getUser()->getId()); + $this->getDoctrine() ->getRepository('WallabagCoreBundle:Entry') ->removeAllByUserId($this->getUser()->getId()); @@ -268,7 +270,7 @@ class ConfigController extends Controller } /** - * Remove all tags for a given user. + * Remove all tags for a given user and cleanup orphan tags * * @param int $userId */ @@ -283,6 +285,16 @@ class ConfigController extends Controller $this->getDoctrine() ->getRepository('WallabagCoreBundle:Entry') ->removeTags($userId, $tags); + + $em = $this->getDoctrine()->getManager(); + + foreach ($tags as $tag) { + if (count($tag->getEntries()) === 0) { + $em->remove($tag); + } + } + + $em->flush(); } /** -- cgit v1.2.3 From 8c61fd12b1df50d481e9f82c39521cca7b8ad060 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 8 Oct 2016 11:14:09 +0200 Subject: CS --- src/Wallabag/CoreBundle/Controller/ConfigController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index e2484064..8d391917 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -253,7 +253,7 @@ class ConfigController extends Controller $this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->removeAllByUserId($this->getUser()->getId()); } - // manually remove tags first to avoid orphan tag + // manually remove tags to avoid orphan tag $this->removeAllTagsByUserId($this->getUser()->getId()); $this->getDoctrine() @@ -270,9 +270,9 @@ class ConfigController extends Controller } /** - * Remove all tags for a given user and cleanup orphan tags + * Remove all tags for a given user and cleanup orphan tags. * - * @param int $userId + * @param int $userId */ private function removeAllTagsByUserId($userId) { @@ -286,6 +286,7 @@ class ConfigController extends Controller ->getRepository('WallabagCoreBundle:Entry') ->removeTags($userId, $tags); + // cleanup orphan tags $em = $this->getDoctrine()->getManager(); foreach ($tags as $tag) { -- cgit v1.2.3 From b0de88f75dead50385e80e3897dc3913a971b91e Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 11 Oct 2016 21:45:43 +0200 Subject: Use statements & update translation --- src/Wallabag/CoreBundle/Controller/TagController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index 5acc6852..4542d484 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -90,15 +90,15 @@ class TagController extends Controller $flatTags = []; - foreach ($tags as $key => $tag) { + foreach ($tags as $tag) { $nbEntries = $this->getDoctrine() ->getRepository('WallabagCoreBundle:Entry') - ->countAllEntriesByUserIdAndTagId($this->getUser()->getId(), $tag['id']); + ->countAllEntriesByUserIdAndTagId($this->getUser()->getId(), $tag->getId()); $flatTags[] = [ - 'id' => $tag['id'], - 'label' => $tag['label'], - 'slug' => $tag['slug'], + 'id' => $tag->getId(), + 'label' => $tag->getLabel(), + 'slug' => $tag->getSlug(), 'nbEntries' => $nbEntries, ]; } -- cgit v1.2.3 From e61ee56031aa0788f9a40ec245d3c391d219d6c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 31 Oct 2016 16:16:41 +0100 Subject: Added QRCode and link to configure android application --- src/Wallabag/CoreBundle/Controller/ConfigController.php | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 8d391917..d40efcd7 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -149,6 +149,7 @@ class ConfigController extends Controller 'token' => $config->getRssToken(), ], 'twofactor_auth' => $this->getParameter('twofactor_auth'), + 'wallabag_url' => $this->get('craue_config')->get('wallabag_url'), 'enabled_users' => $this->getDoctrine() ->getRepository('WallabagUserBundle:User') ->getSumEnabledUsers(), -- cgit v1.2.3 From e0597476d1d5f6a4a7d6ea9b76966465f3d22fb8 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 1 Nov 2016 14:49:02 +0100 Subject: Use custom event instead of Doctrine ones MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This give us ability to use Entry ID to determine where to store images and it’s then more easy to remove them when we remove the entry. --- src/Wallabag/CoreBundle/Controller/EntryController.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 97bb3d12..3f4eb17d 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -13,6 +13,8 @@ use Wallabag\CoreBundle\Form\Type\EntryFilterType; use Wallabag\CoreBundle\Form\Type\EditEntryType; use Wallabag\CoreBundle\Form\Type\NewEntryType; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; +use Wallabag\CoreBundle\Event\EntrySavedEvent; +use Wallabag\CoreBundle\Event\EntryDeletedEvent; class EntryController extends Controller { @@ -81,6 +83,9 @@ class EntryController extends Controller $em->persist($entry); $em->flush(); + // entry saved, dispatch event about it! + $this->get('event_dispatcher')->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); + return $this->redirect($this->generateUrl('homepage')); } @@ -107,6 +112,9 @@ class EntryController extends Controller $em = $this->getDoctrine()->getManager(); $em->persist($entry); $em->flush(); + + // entry saved, dispatch event about it! + $this->get('event_dispatcher')->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); } return $this->redirect($this->generateUrl('homepage')); @@ -343,6 +351,9 @@ class EntryController extends Controller $em->persist($entry); $em->flush(); + // entry saved, dispatch event about it! + $this->get('event_dispatcher')->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); + return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()])); } @@ -431,6 +442,9 @@ class EntryController extends Controller UrlGeneratorInterface::ABSOLUTE_PATH ); + // entry deleted, dispatch event about it! + $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); + $em = $this->getDoctrine()->getManager(); $em->remove($entry); $em->flush(); -- cgit v1.2.3 From 001cc7168aa1a7e9b8290b9c29566c586ac8b511 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 3 Nov 2016 18:01:25 +0100 Subject: Cleanup --- src/Wallabag/CoreBundle/Controller/ConfigController.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index d40efcd7..fe817711 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -234,8 +234,6 @@ class ConfigController extends Controller */ public function resetAction($type) { - $em = $this->getDoctrine()->getManager(); - switch ($type) { case 'annotations': $this->getDoctrine() -- cgit v1.2.3 From ee122a7528f55dfb5f02e351c509d00b756fedaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 4 Nov 2016 23:24:43 +0100 Subject: Added a simple search engine Fix #18 --- .../CoreBundle/Controller/EntryController.php | 33 ++++++++++++++++++++-- .../CoreBundle/Controller/ExportController.php | 2 +- 2 files changed, 32 insertions(+), 3 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 3f4eb17d..fc1697be 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -15,9 +15,33 @@ use Wallabag\CoreBundle\Form\Type\NewEntryType; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; use Wallabag\CoreBundle\Event\EntrySavedEvent; use Wallabag\CoreBundle\Event\EntryDeletedEvent; +use Wallabag\CoreBundle\Form\Type\SearchEntryType; class EntryController extends Controller { + /** + * @param Request $request + * @param int $page + * + * @Route("/search/{page}", name="search", defaults={"page" = "1"}) + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function searchFormAction(Request $request, $page) + { + $form = $this->createForm(SearchEntryType::class); + + $form->handleRequest($request); + + if ($form->isValid()) { + return $this->showEntries('search', $request, $page); + } + + return $this->render('WallabagCoreBundle:Entry:search_form.html.twig', [ + 'form' => $form->createView(), + ]); + } + /** * Fetch content and update entry. * In case it fails, entry will return to avod loosing the data. @@ -244,8 +268,13 @@ class EntryController extends Controller private function showEntries($type, Request $request, $page) { $repository = $this->get('wallabag_core.entry_repository'); + $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); switch ($type) { + case 'search': + $qb = $repository->getBuilderForSearchByUser($this->getUser()->getId(), $searchTerm); + + break; case 'untagged': $qb = $repository->getBuilderForUntaggedByUser($this->getUser()->getId()); @@ -294,11 +323,11 @@ class EntryController extends Controller } return $this->render( - 'WallabagCoreBundle:Entry:entries.html.twig', - [ + 'WallabagCoreBundle:Entry:entries.html.twig', [ 'form' => $form->createView(), 'entries' => $entries, 'currentPage' => $page, + 'searchTerm' => $searchTerm, ] ); } diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php index 79653cfe..abc3336a 100644 --- a/src/Wallabag/CoreBundle/Controller/ExportController.php +++ b/src/Wallabag/CoreBundle/Controller/ExportController.php @@ -48,7 +48,7 @@ class ExportController extends Controller * * @Route("/export/{category}.{format}", name="export_entries", requirements={ * "format": "epub|mobi|pdf|json|xml|txt|csv", - * "category": "all|unread|starred|archive|tag_entries|untagged" + * "category": "all|unread|starred|archive|tag_entries|untagged|search" * }) * * @return \Symfony\Component\HttpFoundation\Response -- cgit v1.2.3 From 49b042dfdf33a0efd3c838e1476754e6019730d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 10 Nov 2016 15:23:53 +0100 Subject: Added translations and currentRoute parameter --- src/Wallabag/CoreBundle/Controller/EntryController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index fc1697be..8c13255e 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -27,7 +27,7 @@ class EntryController extends Controller * * @return \Symfony\Component\HttpFoundation\Response */ - public function searchFormAction(Request $request, $page) + public function searchFormAction(Request $request, $page, $currentRoute) { $form = $this->createForm(SearchEntryType::class); @@ -39,6 +39,7 @@ class EntryController extends Controller return $this->render('WallabagCoreBundle:Entry:search_form.html.twig', [ 'form' => $form->createView(), + 'currentRoute' => $currentRoute, ]); } @@ -269,10 +270,11 @@ class EntryController extends Controller { $repository = $this->get('wallabag_core.entry_repository'); $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); + $currentRoute = (!is_null($request->get('currentRoute')) ? $request->get('currentRoute') : ''); switch ($type) { case 'search': - $qb = $repository->getBuilderForSearchByUser($this->getUser()->getId(), $searchTerm); + $qb = $repository->getBuilderForSearchByUser($this->getUser()->getId(), $searchTerm, $currentRoute); break; case 'untagged': -- cgit v1.2.3 From 8670250a2674b6b388f3d40a8ba291a4dca41b82 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 19 Nov 2016 14:53:28 +0100 Subject: Add RSS pagination Following https://tools.ietf.org/html/rfc5005#page-4 --- .../CoreBundle/Controller/RssController.php | 36 +++++++++++++++++----- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/RssController.php b/src/Wallabag/CoreBundle/Controller/RssController.php index 38e3b5a0..2290386f 100644 --- a/src/Wallabag/CoreBundle/Controller/RssController.php +++ b/src/Wallabag/CoreBundle/Controller/RssController.php @@ -3,12 +3,15 @@ namespace Wallabag\CoreBundle\Controller; use Pagerfanta\Adapter\DoctrineORMAdapter; +use Pagerfanta\Exception\OutOfRangeCurrentPageException; use Pagerfanta\Pagerfanta; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; +use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\UserBundle\Entity\User; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class RssController extends Controller { @@ -20,9 +23,9 @@ class RssController extends Controller * * @return \Symfony\Component\HttpFoundation\Response */ - public function showUnreadAction(User $user) + public function showUnreadAction(Request $request, User $user) { - return $this->showEntries('unread', $user); + return $this->showEntries('unread', $user, $request->query->get('page', 1)); } /** @@ -33,9 +36,9 @@ class RssController extends Controller * * @return \Symfony\Component\HttpFoundation\Response */ - public function showArchiveAction(User $user) + public function showArchiveAction(Request $request, User $user) { - return $this->showEntries('archive', $user); + return $this->showEntries('archive', $user, $request->query->get('page', 1)); } /** @@ -46,9 +49,9 @@ class RssController extends Controller * * @return \Symfony\Component\HttpFoundation\Response */ - public function showStarredAction(User $user) + public function showStarredAction(Request $request, User $user) { - return $this->showEntries('starred', $user); + return $this->showEntries('starred', $user, $request->query->get('page', 1)); } /** @@ -57,10 +60,11 @@ class RssController extends Controller * * @param string $type Entries type: unread, starred or archive * @param User $user + * @param int $page * * @return \Symfony\Component\HttpFoundation\Response */ - private function showEntries($type, User $user) + private function showEntries($type, User $user, $page = 1) { $repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry'); @@ -87,8 +91,26 @@ class RssController extends Controller $perPage = $user->getConfig()->getRssLimit() ?: $this->getParameter('wallabag_core.rss_limit'); $entries->setMaxPerPage($perPage); + $url = $this->generateUrl( + $type.'_rss', + [ + 'username' => $user->getUsername(), + 'token' => $user->getConfig()->getRssToken(), + ], + UrlGeneratorInterface::ABSOLUTE_URL + ); + + try { + $entries->setCurrentPage((int) $page); + } catch (OutOfRangeCurrentPageException $e) { + if ($page > 1) { + return $this->redirect($url.'?page='.$entries->getNbPages(), 302); + } + } + return $this->render('@WallabagCore/themes/common/Entry/entries.xml.twig', [ 'type' => $type, + 'url' => $url, 'entries' => $entries, ]); } -- cgit v1.2.3 From 9f01d0fde09fa055a7db9f26e77c5e6b3d6c2224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 28 Nov 2016 11:02:10 +0100 Subject: Added list view --- .../CoreBundle/Controller/ConfigController.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 52a03070..ea7cd883 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -363,4 +363,25 @@ class ConfigController extends Controller return $this->redirect($this->generateUrl('fos_user_security_login')); } + + /** + * Switch view mode for current user. + * + * @Route("/config/view-mode", name="switch_view_mode") + * + * @param Request $request + * + * @return \Symfony\Component\HttpFoundation\RedirectResponse + */ + public function changeViewModeAction(Request $request) + { + $user = $this->getUser(); + $user->getConfig()->setViewMode(!$user->getConfig()->getViewMode()); + + $em = $this->getDoctrine()->getManager(); + $em->persist($user); + $em->flush(); + + return $this->redirect($request->headers->get('referer')); + } } -- cgit v1.2.3 From 9aa991281ddd315f607cabcfc3b917401d3d2104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 28 Nov 2016 12:08:51 +0100 Subject: Renamed view_mode by list_mode and hide excerpt --- src/Wallabag/CoreBundle/Controller/ConfigController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index ea7cd883..68f30f6e 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -376,7 +376,7 @@ class ConfigController extends Controller public function changeViewModeAction(Request $request) { $user = $this->getUser(); - $user->getConfig()->setViewMode(!$user->getConfig()->getViewMode()); + $user->getConfig()->setListMode(!$user->getConfig()->getListMode()); $em = $this->getDoctrine()->getManager(); $em->persist($user); -- cgit v1.2.3 From 21e7ccef3d960f4747d58fc0c9e081618e9451eb Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 14 Dec 2016 11:54:30 +0100 Subject: Fix tests & deprecation notice --- .../CoreBundle/Controller/ConfigController.php | 10 +++++----- src/Wallabag/CoreBundle/Controller/EntryController.php | 18 +++++++++++++----- src/Wallabag/CoreBundle/Controller/TagController.php | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 68f30f6e..907bf78e 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -35,7 +35,7 @@ class ConfigController extends Controller $configForm = $this->createForm(ConfigType::class, $config, ['action' => $this->generateUrl('config')]); $configForm->handleRequest($request); - if ($configForm->isValid()) { + if ($configForm->isSubmitted() && $configForm->isValid()) { $em->persist($config); $em->flush(); @@ -57,7 +57,7 @@ class ConfigController extends Controller $pwdForm = $this->createForm(ChangePasswordType::class, null, ['action' => $this->generateUrl('config').'#set4']); $pwdForm->handleRequest($request); - if ($pwdForm->isValid()) { + if ($pwdForm->isSubmitted() && $pwdForm->isValid()) { if ($this->get('craue_config')->get('demo_mode_enabled') && $this->get('craue_config')->get('demo_mode_username') === $user->getUsername()) { $message = 'flashes.config.notice.password_not_updated_demo'; } else { @@ -79,7 +79,7 @@ class ConfigController extends Controller ]); $userForm->handleRequest($request); - if ($userForm->isValid()) { + if ($userForm->isSubmitted() && $userForm->isValid()) { $userManager->updateUser($user, true); $this->get('session')->getFlashBag()->add( @@ -94,7 +94,7 @@ class ConfigController extends Controller $rssForm = $this->createForm(RssType::class, $config, ['action' => $this->generateUrl('config').'#set2']); $rssForm->handleRequest($request); - if ($rssForm->isValid()) { + if ($rssForm->isSubmitted() && $rssForm->isValid()) { $em->persist($config); $em->flush(); @@ -125,7 +125,7 @@ class ConfigController extends Controller $newTaggingRule = $this->createForm(TaggingRuleType::class, $taggingRule, ['action' => $action]); $newTaggingRule->handleRequest($request); - if ($newTaggingRule->isValid()) { + if ($newTaggingRule->isSubmitted() && $newTaggingRule->isValid()) { $taggingRule->setConfig($config); $em->persist($taggingRule); $em->flush(); diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 8c13255e..9ed1cb12 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -23,17 +23,25 @@ class EntryController extends Controller * @param Request $request * @param int $page * - * @Route("/search/{page}", name="search", defaults={"page" = "1"}) + * @Route("/search/{page}", name="search", defaults={"page" = 1}) + * + * Default parameter for page is hardcoded (in duplication of the defaults from the Route) + * because this controller is also called inside the layout template without any page as argument * * @return \Symfony\Component\HttpFoundation\Response */ - public function searchFormAction(Request $request, $page, $currentRoute) + public function searchFormAction(Request $request, $page = 1, $currentRoute = null) { + // fallback to retrieve currentRoute from query parameter instead of injected one (when using inside a template) + if (null === $currentRoute && $request->query->has('currentRoute')) { + $currentRoute = $request->query->get('currentRoute'); + } + $form = $this->createForm(SearchEntryType::class); $form->handleRequest($request); - if ($form->isValid()) { + if ($form->isSubmitted() && $form->isValid()) { return $this->showEntries('search', $request, $page); } @@ -90,7 +98,7 @@ class EntryController extends Controller $form->handleRequest($request); - if ($form->isValid()) { + if ($form->isSubmitted() && $form->isValid()) { $existingEntry = $this->checkIfEntryAlreadyExists($entry); if (false !== $existingEntry) { @@ -173,7 +181,7 @@ class EntryController extends Controller $form->handleRequest($request); - if ($form->isValid()) { + if ($form->isSubmitted() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($entry); $em->flush(); diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index a3e70fd0..52707cb8 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -27,7 +27,7 @@ class TagController extends Controller $form = $this->createForm(NewTagType::class, new Tag()); $form->handleRequest($request); - if ($form->isValid()) { + if ($form->isSubmitted() && $form->isValid()) { $this->get('wallabag_core.content_proxy')->assignTagsToEntry( $entry, $form->get('label')->getData() -- cgit v1.2.3 From 6ad8aabb83581fdc978d0cea81be8e776a3b7198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 15 Dec 2016 21:31:13 +0100 Subject: Fixed search bug --- src/Wallabag/CoreBundle/Controller/EntryController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 9ed1cb12..ff6f564e 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -278,7 +278,7 @@ class EntryController extends Controller { $repository = $this->get('wallabag_core.entry_repository'); $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); - $currentRoute = (!is_null($request->get('currentRoute')) ? $request->get('currentRoute') : ''); + $currentRoute = (!is_null($request->query->get('currentRoute')) ? $request->query->get('currentRoute') : ''); switch ($type) { case 'search': -- cgit v1.2.3 From 9deac0c597d10283ac720a57484a78ff960fc138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 13 Dec 2016 20:12:21 +0100 Subject: Removed outputWalkers for pagination Due to overload, we disabled output walkers (see https://github.com/whiteoctober/Pagerfanta/issues/115 --- src/Wallabag/CoreBundle/Controller/EntryController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index ff6f564e..b03f49ed 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -319,7 +319,7 @@ class EntryController extends Controller $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($form, $qb); } - $pagerAdapter = new DoctrineORMAdapter($qb->getQuery()); + $pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false); $entries = $this->get('wallabag_core.helper.prepare_pager_for_entries') ->prepare($pagerAdapter, $page); -- cgit v1.2.3 From 5a5da36955a00a4c07100c81c443d195a4dd01a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 14 Dec 2016 09:00:14 +0100 Subject: Removed outputWalkers for RSS and API --- src/Wallabag/CoreBundle/Controller/RssController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/RssController.php b/src/Wallabag/CoreBundle/Controller/RssController.php index 2290386f..92f18707 100644 --- a/src/Wallabag/CoreBundle/Controller/RssController.php +++ b/src/Wallabag/CoreBundle/Controller/RssController.php @@ -85,7 +85,7 @@ class RssController extends Controller throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); } - $pagerAdapter = new DoctrineORMAdapter($qb->getQuery()); + $pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false); $entries = new Pagerfanta($pagerAdapter); $perPage = $user->getConfig()->getRssLimit() ?: $this->getParameter('wallabag_core.rss_limit'); -- cgit v1.2.3 From 8137515171a9b3c8e7c3720958acfdccb96803f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sun, 18 Dec 2016 14:09:56 +0100 Subject: Fixed index on entry.uuid and changed uuid field type --- src/Wallabag/CoreBundle/Controller/EntryController.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index b03f49ed..83148671 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -355,6 +355,9 @@ class EntryController extends Controller { $this->checkUserAction($entry); + $version = $this->getDoctrine()->getManager()->getConnection()->query('SELECT version();')->fetchColumn(); + var_dump($version); + return $this->render( 'WallabagCoreBundle:Entry:entry.html.twig', ['entry' => $entry] -- cgit v1.2.3 From 89cd670abfc77ca268a538c9323a4026fec06fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 23 Dec 2016 09:49:22 +0100 Subject: Changed uuid type in database --- src/Wallabag/CoreBundle/Controller/EntryController.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 83148671..b03f49ed 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -355,9 +355,6 @@ class EntryController extends Controller { $this->checkUserAction($entry); - $version = $this->getDoctrine()->getManager()->getConnection()->query('SELECT version();')->fetchColumn(); - var_dump($version); - return $this->render( 'WallabagCoreBundle:Entry:entry.html.twig', ['entry' => $entry] -- cgit v1.2.3 From c8de7ab94cb2d8880205c450ebf52d225991df6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 27 Dec 2016 21:26:53 +0100 Subject: Fixed export by tags with a tag which contains space --- src/Wallabag/CoreBundle/Controller/TagController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index 52707cb8..8a093289 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -143,7 +143,7 @@ class TagController extends Controller 'form' => null, 'entries' => $entries, 'currentPage' => $page, - 'tag' => $tag->getLabel(), + 'tag' => $tag->getSlug(), ]); } } -- cgit v1.2.3 From 7239082a5e290dada1d393f7a25acebb09ace2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 29 Dec 2016 10:09:44 +0100 Subject: Renamed uuid to uid --- src/Wallabag/CoreBundle/Controller/EntryController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index b03f49ed..f7398e69 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -539,8 +539,8 @@ class EntryController extends Controller { $this->checkUserAction($entry); - if (null === $entry->getUuid()) { - $entry->generateUuid(); + if (null === $entry->getUid()) { + $entry->generateUid(); $em = $this->getDoctrine()->getManager(); $em->persist($entry); @@ -548,7 +548,7 @@ class EntryController extends Controller } return $this->redirect($this->generateUrl('share_entry', [ - 'uuid' => $entry->getUuid(), + 'uid' => $entry->getUid(), ])); } @@ -565,7 +565,7 @@ class EntryController extends Controller { $this->checkUserAction($entry); - $entry->cleanUuid(); + $entry->cleanUid(); $em = $this->getDoctrine()->getManager(); $em->persist($entry); @@ -581,7 +581,7 @@ class EntryController extends Controller * * @param Entry $entry * - * @Route("/share/{uuid}", requirements={"uuid" = ".+"}, name="share_entry") + * @Route("/share/{uid}", requirements={"uid" = ".+"}, name="share_entry") * @Cache(maxage="25200", smaxage="25200", public=true) * * @return \Symfony\Component\HttpFoundation\Response -- cgit v1.2.3