Added book name to the mail template

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
This commit is contained in:
Sascha 2023-10-26 14:01:38 +02:00 committed by Dan Brown
parent 7c4dc981cd
commit 65ac197be4
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9
5 changed files with 48 additions and 8 deletions

View 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));
}

View 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));

View 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:',

View 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:',

View 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:',