]> BookStack Code Mirror - bookstack/commitdiff
Added book name to the mail template
authorSascha <redacted>
Thu, 26 Oct 2023 12:01:38 +0000 (14:01 +0200)
committerDan Brown <redacted>
Tue, 14 Nov 2023 10:38:34 +0000 (10:38 +0000)
added book name

synced with actual file from dev branch

added book name

add book name

added book name

extended with chaptername

extended with chapter name

Update PageUpdateNotification.php

Update notifications.php

Update notifications.php

Update notifications.php

correction of chapter syntax

correction of chapter syntax

app/Activity/Notifications/Messages/PageCreationNotification.php
app/Activity/Notifications/Messages/PageUpdateNotification.php
lang/de/notifications.php
lang/de_informal/notifications.php
lang/en/notifications.php

index da028aa8c8de2e945772e79854bc9a7c473a9126..e98f0c20c320bead0237d5f414253c6274a7c377 100644 (file)
@@ -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));
     }
index 1c8155d291d42e2a07e562089b6273ac2aabb5e5..a303a7883d92cfadbfd73773b2f7718145684029 100644 (file)
@@ -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));
index 314f0bfe39c0b0b2585c3fbff80d38685d361c69..c1691f89afd4757586862078ab8083952c67e863 100644 (file)
@@ -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:',
index fc6204d501830f4112805270e1fcac7225a477bb..7b01bccd16e20045fbfa92669ca87692259fd4f8 100644 (file)
@@ -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:',
index 5539ae9a9d86de7b1a59aad5aac4742a61fa3be9..f476ee5fc73776d92618e6f6417249cea36d17b9 100644 (file)
@@ -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:',