Fix duplicate article when added via the bookmarklet

This commit is contained in:
Nicolas Lœuillet 2016-04-08 15:41:05 +02:00
parent e969c2a7ef
commit f652f41dab
No known key found for this signature in database
GPG key ID: 5656BE27E1E34D0A

View 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'));
}