From: Nicolas LÅ“uillet Date: Fri, 8 Apr 2016 13:41:05 +0000 (+0200) Subject: Fix duplicate article when added via the bookmarklet X-Git-Tag: 2.0.1~8^2~2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=f652f41dab0b456d24295c8ff47155f28e63f1ed;p=github%2Fwallabag%2Fwallabag.git Fix duplicate article when added via the bookmarklet --- 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')); }