From f652f41dab0b456d24295c8ff47155f28e63f1ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 8 Apr 2016 15:41:05 +0200 Subject: Fix duplicate article when added via the bookmarklet --- src/Wallabag/CoreBundle/Controller/EntryController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/Wallabag') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index fa633031..1d0df889 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -86,7 +86,13 @@ class EntryController extends Controller { $entry = new Entry($this->getUser()); $entry->setUrl($request->get('url')); - $this->updateEntry($entry); + + // check for existing entry, if it exists, redirect to it with a message + $existingEntry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId()); + + if (false === $existingEntry) { + $this->updateEntry($entry); + } return $this->redirect($this->generateUrl('homepage')); } -- cgit v1.2.3