mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-22 17:18:37 +00:00
Share entry with a public URL
This commit is contained in:
parent
1bee9e0760
commit
f3d0cb9106
5 changed files with 116 additions and 1 deletions
|
@ -291,6 +291,8 @@ class EntryController extends Controller
|
|||
{
|
||||
$this->checkUserAction($entry);
|
||||
|
||||
$this->generateEntryUuid($entry);
|
||||
|
||||
return $this->render(
|
||||
'WallabagCoreBundle:Entry:entry.html.twig',
|
||||
['entry' => $entry]
|
||||
|
@ -449,5 +451,34 @@ class EntryController extends Controller
|
|||
private function checkIfEntryAlreadyExists(Entry $entry)
|
||||
{
|
||||
return $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId());
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Share entry content.
|
||||
*
|
||||
* @param Entry $entry
|
||||
*
|
||||
* @Route("/share/{uuid}", requirements={"uuid" = ".+"}, name="share")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function shareEntry(Entry $entry)
|
||||
{
|
||||
return $this->render(
|
||||
'@WallabagCore/themes/share.html.twig',
|
||||
array('entry' => $entry)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Entry $entry
|
||||
*/
|
||||
private function generateEntryUuid(Entry $entry)
|
||||
{
|
||||
$entry->generateUuid();
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($entry);
|
||||
$em->flush();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue