]> BookStack Code Mirror - bookstack/blob - app/Activity/Notifications/Messages/CommentCreationNotification.php
fix Sidebar scrolling at mid-range sceen
[bookstack] / app / Activity / Notifications / Messages / CommentCreationNotification.php
1 <?php
2
3 namespace BookStack\Activity\Notifications\Messages;
4
5 use BookStack\Activity\Models\Comment;
6 use BookStack\Activity\Notifications\MessageParts\ListMessageLine;
7 use BookStack\Entities\Models\Page;
8 use BookStack\Users\Models\User;
9 use Illuminate\Notifications\Messages\MailMessage;
10
11 class CommentCreationNotification extends BaseActivityNotification
12 {
13     public function toMail(User $notifiable): MailMessage
14     {
15         /** @var Comment $comment */
16         $comment = $this->detail;
17         /** @var Page $page */
18         $page = $comment->entity;
19
20         $locale = $notifiable->getLocale();
21
22         return $this->newMailMessage($locale)
23             ->subject($locale->trans('notifications.new_comment_subject', ['pageName' => $page->getShortName()]))
24             ->line($locale->trans('notifications.new_comment_intro', ['appName' => setting('app-name')]))
25             ->line(new ListMessageLine([
26                 $locale->trans('notifications.detail_page_name') => $page->name,
27                 $locale->trans('notifications.detail_commenter') => $this->user->name,
28                 $locale->trans('notifications.detail_comment') => strip_tags($comment->html),
29             ]))
30             ->action($locale->trans('notifications.action_view_comment'), $page->getUrl('#comment' . $comment->local_id))
31             ->line($this->buildReasonFooterLine($locale));
32     }
33 }