]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge pull request #1546 from wallabag/v2-reload-content
authorNicolas Lœuillet <nicolas@loeuillet.org>
Sat, 2 Jan 2016 11:46:09 +0000 (12:46 +0100)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Sat, 2 Jan 2016 11:46:09 +0000 (12:46 +0100)
v2 – Ability to reload an entry

1  2 
src/Wallabag/CoreBundle/Controller/EntryController.php

index b437e0292cda923ff2db555540336f685e0af413,041fe71ca77af8166e7787d1202c157af4af340d..fa58013312a74169207f4795c2e8c4dd253f474f
@@@ -266,6 -266,33 +266,33 @@@ class EntryController extends Controlle
          );
      }
  
+     /**
+      * Reload an entry.
+      * Refetch content from the website and make it readable again.
+      *
+      * @param Entry $entry
+      *
+      * @Route("/reload/{id}", requirements={"id" = "\d+"}, name="reload_entry")
+      *
+      * @return \Symfony\Component\HttpFoundation\RedirectResponse
+      */
+     public function reloadAction(Entry $entry)
+     {
+         $this->checkUserAction($entry);
+         $message = 'Entry reloaded';
+         if (false === $this->updateEntry($entry)) {
+             $message = 'Failed to reload entry';
+         }
+         $this->get('session')->getFlashBag()->add(
+             'notice',
+             $message
+         );
+         return $this->redirect($this->generateUrl('view', array('id' => $entry->getId())));
+     }
      /**
       * Changes read status for an entry.
       *
          );
  
          // don't redirect user to the deleted entry
 -        return $this->redirect($url !== $request->headers->get('referer') ?: $this->generateUrl('homepage'));
 +        return $this->redirect($url !== $request->headers->get('referer') ? $request->headers->get('referer') : $this->generateUrl('homepage'));
      }
  
      /**