mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
fix: a push notification is not chat
This commit is contained in:
@@ -9,13 +9,15 @@ use Symfony\Component\Mime\Address;
|
||||
use Symfony\Component\Mime\Email;
|
||||
use Symfony\Component\Notifier\Message\ChatMessage;
|
||||
use Symfony\Component\Notifier\Message\EmailMessage;
|
||||
use Symfony\Component\Notifier\Message\PushMessage;
|
||||
use Symfony\Component\Notifier\Notification\ChatNotificationInterface;
|
||||
use Symfony\Component\Notifier\Notification\EmailNotificationInterface;
|
||||
use Symfony\Component\Notifier\Notification\Notification;
|
||||
use Symfony\Component\Notifier\Notification\PushNotificationInterface;
|
||||
use Symfony\Component\Notifier\Recipient\EmailRecipientInterface;
|
||||
use Symfony\Component\Notifier\Recipient\RecipientInterface;
|
||||
|
||||
class DomainOrderNotification extends Notification implements ChatNotificationInterface, EmailNotificationInterface
|
||||
class DomainOrderNotification extends Notification implements ChatNotificationInterface, EmailNotificationInterface, PushNotificationInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly Address $sender,
|
||||
@@ -36,6 +38,17 @@ class DomainOrderNotification extends Notification implements ChatNotificationIn
|
||||
return ChatMessage::fromNotification($this);
|
||||
}
|
||||
|
||||
public function asPushMessage(?RecipientInterface $recipient = null, ?string $transport = null): ?PushMessage
|
||||
{
|
||||
$ldhName = $this->domain->getLdhName();
|
||||
$this
|
||||
->subject("Success: Domain Ordered $ldhName!")
|
||||
->content("Domain name $ldhName has just been purchased. The API provider did not return an error.")
|
||||
->importance(Notification::IMPORTANCE_HIGH);
|
||||
|
||||
return PushMessage::fromNotification($this);
|
||||
}
|
||||
|
||||
public function asEmailMessage(EmailRecipientInterface $recipient, ?string $transport = null): EmailMessage
|
||||
{
|
||||
return new EmailMessage((new TemplatedEmail())
|
||||
|
||||
Reference in New Issue
Block a user