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 $language = $notifiable->getLanguage();
22 return $this->newMailMessage($language)
23 ->subject(trans('notifications.new_comment_subject', ['pageName' => $page->getShortName()], $language))
24 ->line(trans('notifications.new_comment_intro', ['appName' => setting('app-name')], $language))
25 ->line(new ListMessageLine([
26 trans('notifications.detail_page_name', [], $language) => $page->name,
27 trans('notifications.detail_commenter', [], $language) => $this->user->name,
28 trans('notifications.detail_comment', [], $language) => strip_tags($comment->html),
30 ->action(trans('notifications.action_view_comment', [], $language), $page->getUrl('#comment' . $comment->local_id))
31 ->line($this->buildReasonFooterLine($language));