Skip to content

Commit f918956

Browse files
committed
Use '_fragment' parameter
1 parent 1e83a1d commit f918956

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/AppBundle/EventListener/CommentNotificationListener.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,15 @@ public function onCommentCreated(GenericEvent $event)
6666
$comment = $event->getSubject();
6767
$post = $comment->getPost();
6868

69-
$linkToPost = $this->urlGenerator->generate('blog_post', ['slug' => $post->getSlug()], UrlGeneratorInterface::ABSOLUTE_URL);
69+
$linkToPost = $this->urlGenerator->generate('blog_post', [
70+
'slug' => $post->getSlug(),
71+
'_fragment' => 'comment_'.$comment->getId(),
72+
], UrlGeneratorInterface::ABSOLUTE_URL);
7073

71-
$subject = $this->translator->trans('post.recieved_comment');
72-
$body = $this->translator->trans('post.recieved_comment_message', [
74+
$subject = $this->translator->trans('post.comment_added');
75+
$body = $this->translator->trans('post.comment_added.description', [
7376
'%title%' => $post->getTitle(),
74-
'%link%' => $linkToPost.'#comment_'.$comment->getId(),
77+
'%link%' => $linkToPost,
7578
]);
7679

7780
// Symfony uses a library called SwiftMailer to send emails. That's why

0 commit comments

Comments
 (0)