diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-04-10 17:33:15 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-08-23 16:49:21 +0200 |
commit | f3d0cb91063840f2b05c63954d3fef3e5b8943fd (patch) | |
tree | 5ee9a0c73e7a3e4c8d6da1761a8ce23110f8125a /src/Wallabag/CoreBundle/Controller | |
parent | 1bee9e0760c89756ebab0b67f9ab7efc5c6a709b (diff) | |
download | wallabag-f3d0cb91063840f2b05c63954d3fef3e5b8943fd.tar.gz wallabag-f3d0cb91063840f2b05c63954d3fef3e5b8943fd.tar.zst wallabag-f3d0cb91063840f2b05c63954d3fef3e5b8943fd.zip |
Share entry with a public URL
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 93db0d6c..a78dd00c 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -291,6 +291,8 @@ class EntryController extends Controller | |||
291 | { | 291 | { |
292 | $this->checkUserAction($entry); | 292 | $this->checkUserAction($entry); |
293 | 293 | ||
294 | $this->generateEntryUuid($entry); | ||
295 | |||
294 | return $this->render( | 296 | return $this->render( |
295 | 'WallabagCoreBundle:Entry:entry.html.twig', | 297 | 'WallabagCoreBundle:Entry:entry.html.twig', |
296 | ['entry' => $entry] | 298 | ['entry' => $entry] |
@@ -449,5 +451,34 @@ class EntryController extends Controller | |||
449 | private function checkIfEntryAlreadyExists(Entry $entry) | 451 | private function checkIfEntryAlreadyExists(Entry $entry) |
450 | { | 452 | { |
451 | return $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId()); | 453 | return $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId()); |
454 | |||
455 | } | ||
456 | |||
457 | /* | ||
458 | * Share entry content. | ||
459 | * | ||
460 | * @param Entry $entry | ||
461 | * | ||
462 | * @Route("/share/{uuid}", requirements={"uuid" = ".+"}, name="share") | ||
463 | * | ||
464 | * @return \Symfony\Component\HttpFoundation\Response | ||
465 | */ | ||
466 | public function shareEntry(Entry $entry) | ||
467 | { | ||
468 | return $this->render( | ||
469 | '@WallabagCore/themes/share.html.twig', | ||
470 | array('entry' => $entry) | ||
471 | ); | ||
472 | } | ||
473 | |||
474 | /** | ||
475 | * @param Entry $entry | ||
476 | */ | ||
477 | private function generateEntryUuid(Entry $entry) | ||
478 | { | ||
479 | $entry->generateUuid(); | ||
480 | $em = $this->getDoctrine()->getManager(); | ||
481 | $em->persist($entry); | ||
482 | $em->flush(); | ||
452 | } | 483 | } |
453 | } | 484 | } |