Added system polling
This commit is contained in:
@@ -5,7 +5,6 @@ namespace App\Notifications\Channels;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Jobs\AddressPoll as Job;
|
||||
use App\Models\Netmail;
|
||||
use App\Models\Setup;
|
||||
|
||||
@@ -43,7 +42,6 @@ class NetmailChannel
|
||||
$so = Setup::findOrFail(config('app.id'))->system;
|
||||
$o = $notification->toNetmail($so,$notifiable);
|
||||
|
||||
Job::dispatch($ao);
|
||||
Log::info(sprintf('%s:= Sent netmail [%s] to [%s]',self::LOGKEY,$o->msgid,$ao->ftn));
|
||||
}
|
||||
}
|
58
app/Notifications/Netmails/PollingFailed.php
Normal file
58
app/Notifications/Netmails/PollingFailed.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications\Netmails;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\FTN\Message;
|
||||
use App\Notifications\Netmails;
|
||||
use App\Models\{Netmail,System};
|
||||
use App\Traits\{MessagePath,PageTemplate};
|
||||
|
||||
class PollingFailed extends Netmails
|
||||
{
|
||||
use MessagePath,PageTemplate;
|
||||
|
||||
private const LOGKEY = 'NPF';
|
||||
|
||||
private Carbon $attempt;
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param System $so
|
||||
* @param mixed $notifiable
|
||||
* @return Netmail
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function toNetmail(System $so,object $notifiable): Netmail
|
||||
{
|
||||
$o = $this->setupNetmail($so,$notifiable);
|
||||
$ao = $notifiable->routeNotificationFor(static::via);
|
||||
|
||||
Log::info(sprintf('%s:+ Creating auto hold netmail to [%s]',self::LOGKEY,$ao->ftn));
|
||||
|
||||
$o->subject = 'Failed polling - your system is on AUTO HOLD';
|
||||
|
||||
// Message
|
||||
$msg = $this->page(FALSE,'hold');
|
||||
|
||||
$msg->addText("Hi, I've been trying to poll your system without success.\r\r");
|
||||
|
||||
$msg->addText("Your system was automatically placed on hold, which means I no longer attempted to poll you.\r\r");
|
||||
|
||||
$msg->addText(
|
||||
'Since you collected this message, I automatically removed the auto hold status, but if future attempts to poll you fail '.
|
||||
"you'll be automatically placed back on auto hold until you poll me. You'll also get this annoying message each time :(\r\r");
|
||||
|
||||
$msg->addText("To fix this, update your details that I use in the web interface, or change your system to HOLD while you are there.\r\r");
|
||||
|
||||
$o->msg = $msg->render();
|
||||
$o->tagline = 'Painful? We can make that painless :)';
|
||||
|
||||
$o->save();
|
||||
|
||||
return $o;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user