3 namespace BookStack\Activity\Notifications\Messages;
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;
11 class CommentCreationNotification extends BaseActivityNotification
13 public function toMail(User $notifiable): MailMessage
15 /** @var Comment $comment */
16 $comment = $this->detail;
17 /** @var Page $page */
18 $page = $comment->entity;
20 $locale = $notifiable->getLocale();
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),
30 ->action($locale->trans('notifications.action_view_comment'), $page->getUrl('#comment' . $comment->local_id))
31 ->line($this->buildReasonFooterLine($locale));