clrghouz/app/Notifications/Netmails/NodeStatusCleared.php
Deon George 4501443a43
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 47s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m53s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
Improvements to finding idle nodes, last_session actually only shows the last time the remote polled us
2024-09-15 22:37:35 +10:00

55 lines
1.4 KiB
PHP

<?php
namespace App\Notifications\Netmails;
use Illuminate\Bus\Queueable;
use Illuminate\Support\Facades\Log;
use App\Classes\FTN\Message;
use App\Notifications\Netmails;
use App\Models\{Address,Netmail};
use App\Traits\PageTemplate;
class NodeStatusCleared extends Netmails //implements ShouldQueue
{
use Queueable,PageTemplate;
private const LOGKEY = 'NNM';
/**
* Create a new notification instance.
*/
public function __construct(private Address $ao)
{
parent::__construct();
}
/**
* Get the mail representation of the notification.
*/
public function toNetmail(object $notifiable): Netmail
{
$ao = $notifiable->routeNotificationFor(static::via);
Log::info(sprintf('%s:+ Sending a NODE DOWN|HOLD STATUS CLEARED NETMAIL for address [%s]',self::LOGKEY,$ao->ftn));
$o = $this->setupNetmail($notifiable);
$o->subject = 'Your HOLD or DOWN status has been cleared';
$o->flags = (Message::FLAG_LOCAL|Message::FLAG_PRIVATE|Message::FLAG_CRASH);
// Message
$msg = $this->page(TRUE,'reset');
$msg->addText(sprintf("Hi %s,\r\r",$this->ao->system->sysop))
->addText(sprintf("Good news! Your system's HOLD or DOWN status has been **cleared** for address %s, as you recently polled the hub.\r",$this->ao->ftn4d))
->addText("\r")
->addText("If you think you've received this netmail by mistake or need help, please let me know.\r");
$o->msg = $msg->render();
$o->set_tagline = 'All good to go now';
$o->save();
return $o;
}
}