]> BookStack Code Mirror - bookstack/blob - app/Activity/Notifications/Messages/CommentCreationNotification.php
Merge branch 'add-priority' into development
[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 Illuminate\Notifications\Messages\MailMessage;
9
10 class CommentCreationNotification extends BaseActivityNotification
11 {
12     public function toMail(mixed $notifiable): MailMessage
13     {
14         /** @var Comment $comment */
15         $comment = $this->detail;
16         /** @var Page $page */
17         $page = $comment->entity;
18
19         return (new MailMessage())
20             ->subject(trans('notifications.new_comment_subject', ['pageName' => $page->getShortName()]))
21             ->line(trans('notifications.new_comment_intro', ['appName' => setting('app-name')]))
22             ->line(new ListMessageLine([
23                 trans('notifications.detail_page_name') => $page->name,
24                 trans('notifications.detail_commenter') => $this->user->name,
25                 trans('notifications.detail_comment') => strip_tags($comment->html),
26             ]))
27             ->action(trans('notifications.action_view_comment'), $page->getUrl('#comment' . $comment->local_id))
28             ->line($this->buildReasonFooterLine());
29     }
30 }