NOW MANAGED ON CODEBERG
Added book name to the mail template
Sascha65ac197be440
diff --git a/app/Activity/Notifications/Messages/PageCreationNotification.php b/app/Activity/Notifications/Messages/PageCreationNotification.phpindex da028aa8c..e98f0c20c 100644--- a/app/Activity/Notifications/Messages/PageCreationNotification.php+++ b/app/Activity/Notifications/Messages/PageCreationNotification.php@@ -4,6 +4,7 @@ namespace BookStack\Activity\Notifications\Messages;use BookStack\Activity\Notifications\MessageParts\ListMessageLine;use BookStack\Entities\Models\Page;+use BookStack\Entities\Models\Chapter;use BookStack\Users\Models\User;use Illuminate\Notifications\Messages\MailMessage;@@ -13,16 +14,32 @@ class PageCreationNotification extends BaseActivityNotification{/** @var Page $page */$page = $this->detail;+ $book = $page->book;+ $chapterId = $page->chapter_id;+ $chapter = $chapterId ? Chapter::find($chapterId) : null;$locale = $notifiable->getLocale();+ $listMessageData = [+ $locale->trans('notifications.detail_page_name') => $page->name,+ '' => '',+ ];++ if ($chapter) {+ $listMessageData += [+ $locale->trans('notifications.detail_chapter_name') => $chapter->name,+ ];+ }++ $listMessageData += [+ $locale->trans('notifications.detail_book_name') => $book->name,+ $locale->trans('notifications.detail_created_by') => $this->user->name,+ ];+return $this->newMailMessage($locale)->subject($locale->trans('notifications.new_page_subject', ['pageName' => $page->getShortName()]))->line($locale->trans('notifications.new_page_intro', ['appName' => setting('app-name')], $locale))- ->line(new ListMessageLine([- $locale->trans('notifications.detail_page_name') => $page->name,- $locale->trans('notifications.detail_created_by') => $this->user->name,- ]))+ ->line(new ListMessageLine($listMessageData))->action($locale->trans('notifications.action_view_page'), $page->getUrl())->line($this->buildReasonFooterLine($locale));}diff --git a/app/Activity/Notifications/Messages/PageUpdateNotification.php b/app/Activity/Notifications/Messages/PageUpdateNotification.phpindex 1c8155d29..a303a7883 100644--- a/app/Activity/Notifications/Messages/PageUpdateNotification.php+++ b/app/Activity/Notifications/Messages/PageUpdateNotification.php@@ -4,6 +4,7 @@ namespace BookStack\Activity\Notifications\Messages;use BookStack\Activity\Notifications\MessageParts\ListMessageLine;use BookStack\Entities\Models\Page;+use BookStack\Entities\Models\Chapter;use BookStack\Users\Models\User;use Illuminate\Notifications\Messages\MailMessage;@@ -13,16 +14,32 @@ class PageUpdateNotification extends BaseActivityNotification{/** @var Page $page */$page = $this->detail;+ $book = $page->book;+ $chapterId = $page->chapter_id;+ $chapter = $chapterId ? Chapter::find($chapterId) : null;$locale = $notifiable->getLocale();+ $listMessageData = [+ $locale->trans('notifications.detail_page_name') => $page->name,+ '' => '',+ ];++ if ($chapter) {+ $listMessageData += [+ $locale->trans('notifications.detail_chapter_name') => $chapter->name,+ ];+ }++ $listMessageData += [+ $locale->trans('notifications.detail_book_name') => $book->name,+ $locale->trans('notifications.detail_updated_by') => $this->user->name,+ ];+return $this->newMailMessage($locale)->subject($locale->trans('notifications.updated_page_subject', ['pageName' => $page->getShortName()]))->line($locale->trans('notifications.updated_page_intro', ['appName' => setting('app-name')]))- ->line(new ListMessageLine([- $locale->trans('notifications.detail_page_name') => $page->name,- $locale->trans('notifications.detail_updated_by') => $this->user->name,- ]))+ ->line(new ListMessageLine($listMessageData))->line($locale->trans('notifications.updated_page_debounce'))->action($locale->trans('notifications.action_view_page'), $page->getUrl())->line($this->buildReasonFooterLine($locale));diff --git a/lang/de/notifications.php b/lang/de/notifications.phpindex 314f0bfe3..c1691f89a 100644--- a/lang/de/notifications.php+++ b/lang/de/notifications.php@@ -12,6 +12,8 @@ return ['updated_page_intro' => 'Eine Seite wurde in :appName aktualisiert:','updated_page_debounce' => 'Um eine Flut von Benachrichtigungen zu vermeiden, werden Sie für eine gewisse Zeit keine Benachrichtigungen für weitere Bearbeitungen dieser Seite durch denselben Bearbeiter erhalten.',+ 'detail_book_name' => 'Name des Buches:',+ 'detail_chapter_name' => 'Name des Kapitels:','detail_page_name' => 'Name der Seite:','detail_commenter' => 'Kommentator:','detail_comment' => 'Kommentar:',diff --git a/lang/de_informal/notifications.php b/lang/de_informal/notifications.phpindex fc6204d50..7b01bccd1 100644--- a/lang/de_informal/notifications.php+++ b/lang/de_informal/notifications.php@@ -12,6 +12,8 @@ return ['updated_page_intro' => 'Eine Seite wurde in :appName aktualisiert:','updated_page_debounce' => 'Um eine Flut von Benachrichtigungen zu vermeiden, wirst du für eine gewisse Zeit keine Benachrichtigungen für weitere Bearbeitungen dieser Seite durch denselben Bearbeiter erhalten.',+ 'detail_book_name' => 'Buchname:',+ 'detail_chapter_name' => 'Kapitelname:','detail_page_name' => 'Seitenname:','detail_commenter' => 'Kommentator:','detail_comment' => 'Kommentar:',diff --git a/lang/en/notifications.php b/lang/en/notifications.phpindex 5539ae9a9..f476ee5fc 100644--- a/lang/en/notifications.php+++ b/lang/en/notifications.php@@ -12,6 +12,8 @@ return ['updated_page_intro' => 'A page has been updated in :appName:','updated_page_debounce' => 'To prevent a mass of notifications, for a while you won\'t be sent notifications for further edits to this page by the same editor.',+ 'detail_book_name' => 'Book Name:',+ 'detail_chapter_name' => 'Chapter Name:','detail_page_name' => 'Page Name:','detail_commenter' => 'Commenter:','detail_comment' => 'Comment:',