|
@@ -34,13 +34,13 @@ discard block |
|
|
block discarded – undo |
|
34
|
34
|
*/ |
|
35
|
35
|
public function deleteTrick(Comment $comment, Request $request) |
|
36
|
36
|
{ |
|
37
|
|
- if(!($this->isGranted('ROLE_ADMIN') || $this->getUser()->getId() === $comment->getUser()->getId())) |
|
|
37
|
+ if (!($this->isGranted('ROLE_ADMIN') || $this->getUser()->getId() === $comment->getUser()->getId())) |
|
38
|
38
|
{ |
|
39
|
|
- Throw new RedirectException($this->generateUrl('trick.show', ['id'=> $comment->getTrick()->getId(), 'slug'=> $comment->getTrick()->getSlug()]),"You are not allowed to edit this comment"); |
|
|
39
|
+ Throw new RedirectException($this->generateUrl('trick.show', ['id'=> $comment->getTrick()->getId(), 'slug'=> $comment->getTrick()->getSlug()]), "You are not allowed to edit this comment"); |
|
40
|
40
|
} |
|
41
|
41
|
|
|
42
|
42
|
$submittedToken = $request->request->get('_token'); |
|
43
|
|
- if (!$this->isCsrfTokenValid('delete-comment' . $comment->getId(), $submittedToken)) { |
|
|
43
|
+ if (!$this->isCsrfTokenValid('delete-comment'.$comment->getId(), $submittedToken)) { |
|
44
|
44
|
throw new RedirectException($this->generateUrl('home'), 'Bad CSRF Token'); |
|
45
|
45
|
} |
|
46
|
46
|
|
|
@@ -49,6 +49,6 @@ discard block |
|
|
block discarded – undo |
|
49
|
49
|
$event = new CommentDeletedEvent($comment); |
|
50
|
50
|
$this->dispatcher->dispatch(CommentDeletedEvent::NAME, $event); |
|
51
|
51
|
|
|
52
|
|
- return $this->redirectToRoute('trick.show',['id'=> $trick->getId(), 'slug' => $trick->getSlug()]); |
|
|
52
|
+ return $this->redirectToRoute('trick.show', ['id'=> $trick->getId(), 'slug' => $trick->getSlug()]); |
|
53
|
53
|
} |
|
54
|
54
|
} |
|
55
|
55
|
\ No newline at end of file |