From f652f41dab0b456d24295c8ff47155f28e63f1ed Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 8 Apr 2016 15:41:05 +0200 Subject: [PATCH] Fix duplicate article when added via the bookmarklet --- src/Wallabag/CoreBundle/Controller/EntryController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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')); } -- 2.41.0