mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-12-14 15:13:37 +08:00
3847a76134
- This ensures content notifications are not translated to receiver language. - This adds actual plaintext support for content notifications (Was previously just HTML as text view). - Shares same base class across all mail notifications. - Also cleaned up existing notification classes. Future cleanup requested via #4501
47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace BookStack\Activity\Notifications\Messages;
|
|
|
|
use BookStack\Activity\Models\Loggable;
|
|
use BookStack\Activity\Notifications\MessageParts\LinkedMailMessageLine;
|
|
use BookStack\Notifications\MailNotification;
|
|
use BookStack\Users\Models\User;
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
abstract class BaseActivityNotification extends MailNotification
|
|
{
|
|
use Queueable;
|
|
|
|
public function __construct(
|
|
protected Loggable|string $detail,
|
|
protected User $user,
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* Get the array representation of the notification.
|
|
*
|
|
* @param mixed $notifiable
|
|
* @return array
|
|
*/
|
|
public function toArray($notifiable)
|
|
{
|
|
return [
|
|
'activity_detail' => $this->detail,
|
|
'activity_creator' => $this->user,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Build the common reason footer line used in mail messages.
|
|
*/
|
|
protected function buildReasonFooterLine(string $language): LinkedMailMessageLine
|
|
{
|
|
return new LinkedMailMessageLine(
|
|
url('/preferences/notifications'),
|
|
trans('notifications.footer_reason', [], $language),
|
|
trans('notifications.footer_reason_link', [], $language),
|
|
);
|
|
}
|
|
}
|