mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-19 18:01:37 +00:00
fix notifications (#109)
This commit is contained in:
parent
f70963d6bb
commit
9db310a06b
@ -8,7 +8,7 @@ interface Notification
|
||||
{
|
||||
public function rawText(): string;
|
||||
|
||||
public function toMail(object $notifiable): MailMessage;
|
||||
public function toEmail(object $notifiable): MailMessage;
|
||||
|
||||
public function toSlack(object $notifiable): string;
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\NotificationChannels;
|
||||
|
||||
use App\Contracts\Notification;
|
||||
use App\Models\NotificationChannel;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class Discord extends AbstractNotificationChannel
|
||||
@ -60,6 +61,8 @@ private function checkConnection(string $subject, string $text): bool
|
||||
|
||||
public function send(object $notifiable, Notification $notification): void
|
||||
{
|
||||
/** @var NotificationChannel $notifiable */
|
||||
$this->notificationChannel = $notifiable;
|
||||
$data = $this->notificationChannel->data;
|
||||
Http::post($data['webhook_url'], [
|
||||
'content' => $notification->toSlack($notifiable),
|
||||
|
@ -51,8 +51,7 @@ public function send(object $notifiable, Notification $notification): void
|
||||
{
|
||||
/** @var NotificationChannel $notifiable */
|
||||
$this->notificationChannel = $notifiable;
|
||||
$message = $notification->toMail($notifiable);
|
||||
|
||||
$message = $notification->toEmail($notifiable);
|
||||
Mail::to($this->data()['email'])->send(
|
||||
new NotificationMail($message->subject, $message->render())
|
||||
);
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\NotificationChannels;
|
||||
|
||||
use App\Contracts\Notification;
|
||||
use App\Models\NotificationChannel;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class Slack extends AbstractNotificationChannel
|
||||
@ -60,6 +61,8 @@ private function checkConnection(string $subject, string $text): bool
|
||||
|
||||
public function send(object $notifiable, Notification $notification): void
|
||||
{
|
||||
/** @var NotificationChannel $notifiable */
|
||||
$this->notificationChannel = $notifiable;
|
||||
$data = $this->notificationChannel->data;
|
||||
Http::post($data['webhook_url'], [
|
||||
'text' => $notification->toSlack($notifiable),
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\NotificationChannels;
|
||||
|
||||
use App\Contracts\Notification;
|
||||
use App\Models\NotificationChannel;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Throwable;
|
||||
|
||||
@ -47,6 +48,8 @@ public function connect(): bool
|
||||
|
||||
public function send(object $notifiable, Notification $notification): void
|
||||
{
|
||||
/** @var NotificationChannel $notifiable */
|
||||
$this->notificationChannel = $notifiable;
|
||||
$this->sendToTelegram($notification->toTelegram($notifiable));
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ public function via(object $notifiable): string
|
||||
return get_class($notifiable->provider());
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
public function toEmail(object $notifiable): MailMessage
|
||||
{
|
||||
return (new MailMessage())
|
||||
->subject('Notification')
|
||||
|
@ -25,7 +25,7 @@ public function rawText(): string
|
||||
]);
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
public function toEmail(object $notifiable): MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject(__('Failed to delete the server from the provider!'))
|
||||
|
@ -21,7 +21,7 @@ public function rawText(): string
|
||||
]);
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
public function toEmail(object $notifiable): MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject(__('Server disconnected!'))
|
||||
|
@ -22,7 +22,7 @@ public function rawText(): string
|
||||
]);
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
public function toEmail(object $notifiable): MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject(__('Server installation failed!'))
|
||||
|
@ -22,7 +22,7 @@ public function rawText(): string
|
||||
]);
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
public function toEmail(object $notifiable): MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject(__('Server installation started!'))
|
||||
|
@ -32,7 +32,7 @@ public function rawText(): string
|
||||
]);
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
public function toEmail(object $notifiable): MailMessage
|
||||
{
|
||||
$this->server->refresh();
|
||||
|
||||
|
@ -19,7 +19,7 @@ public function rawText(): string
|
||||
]);
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
public function toEmail(object $notifiable): MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject(__('Site installation failed!'))
|
||||
|
@ -18,7 +18,7 @@ public function rawText(): string
|
||||
]);
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
public function toEmail(object $notifiable): MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject(__('Site installation succeed!'))
|
||||
|
@ -18,7 +18,7 @@ public function rawText(): string
|
||||
]);
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
public function toEmail(object $notifiable): MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject(__('Source control disconnected!'))
|
||||
|
Loading…
x
Reference in New Issue
Block a user