Fixing privacy in PostController::showAction().

This commit is contained in:
Alexey Skobkin 2019-04-03 18:07:47 +03:00
parent 184030ebd5
commit 0c004085fd

View file

@ -17,6 +17,10 @@ class PostController extends AbstractController
*/ */
public function showAction(Post $post, PostRepository $postRepository): Response public function showAction(Post $post, PostRepository $postRepository): Response
{ {
if ((!$post->getAuthor()->isPublic()) || $post->getAuthor()->isWhitelistOnly()) {
throw $this->createNotFoundException('Author\'s blog is private.');
}
return $this->render('SkobkinPointToolsBundle:Post:show.html.twig', [ return $this->render('SkobkinPointToolsBundle:Post:show.html.twig', [
'post' => $postRepository->getPostWithComments($post->getId()), 'post' => $postRepository->getPostWithComments($post->getId()),
]); ]);