3 namespace BookStack\Activity\Notifications\Messages;
5 use BookStack\Activity\Models\Comment;
6 use BookStack\Activity\Notifications\LinkedMailMessageLine;
7 use BookStack\Entities\Models\Page;
8 use Illuminate\Notifications\Messages\MailMessage;
10 class CommentCreationNotification extends BaseActivityNotification
12 public function toMail(mixed $notifiable): MailMessage
14 /** @var Comment $comment */
15 $comment = $this->detail;
16 /** @var Page $page */
17 $page = $comment->entity;
19 return (new MailMessage())
20 ->subject("New Comment on Page: " . $page->getShortName())
21 ->line("A user has commented on a page in " . setting('app-name') . ':')
22 ->line("Page Name: " . $page->name)
23 ->line("Commenter: " . $this->user->name)
24 ->line("Comment: " . strip_tags($comment->html))
25 ->action('View Comment', $page->getUrl('#comment' . $comment->local_id))
26 ->line(new LinkedMailMessageLine(
27 url('/preferences/notifications'),
28 'This notification was sent to you because :link cover this type of activity for this item.',
29 'your notification preferences',