From 2297d60f100effc1bf4300488a170a6bed3ae756 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 20 Oct 2016 22:49:46 +0200 Subject: =?UTF-8?q?If=20reload=20content=20failed,=20don=E2=80=99t=20updat?= =?UTF-8?q?e=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In case user wants a fresh version of the current one and the website isn’t available, don’t erase it with a boring message saying wallabag wasn’t able to refresh the content. --- src/Wallabag/CoreBundle/Controller/EntryController.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/Wallabag/CoreBundle/Controller/EntryController.php') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 3b28e635..97bb3d12 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -330,6 +330,15 @@ class EntryController extends Controller $this->updateEntry($entry, 'entry_reloaded'); + // if refreshing entry failed, don't save it + if ($this->getParameter('wallabag_core.fetching_error_message') === $entry->getContent()) { + $bag = $this->get('session')->getFlashBag(); + $bag->clear(); + $bag->add('notice', 'flashes.entry.notice.entry_reloaded_failed'); + + return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()])); + } + $em = $this->getDoctrine()->getManager(); $em->persist($entry); $em->flush(); -- cgit v1.2.3