]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Fix duplicate article when added via the bookmarklet
authorNicolas Lœuillet <nicolas@loeuillet.org>
Fri, 8 Apr 2016 13:41:05 +0000 (15:41 +0200)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Fri, 8 Apr 2016 13:41:05 +0000 (15:41 +0200)
src/Wallabag/CoreBundle/Controller/EntryController.php

index fa6330314209c36872e1b1b9d2100ea1f05d074c..1d0df889e00043731565d485889966c8a946ccc3 100644 (file)
@@ -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'));
     }