clrghouz/app/Notifications/Netmails/EchoareaNotExist.php
Deon George 4d7af7c7e3
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 42s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m51s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s
Store datetime in UTC format now, and fix presentation of TZUTC. Also standardise message summaries on Notifications
2024-06-28 23:27:06 +10:00

67 lines
1.6 KiB
PHP

<?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\{Echomail,Netmail};
use App\Traits\{MessagePath,PageTemplate};
class EchoareaNotExist extends Netmails
{
use MessagePath,PageTemplate;
private const LOGKEY = 'NNW';
private Echomail $mo;
/**
* Send a sysop a message if they attempt to write to an area that doesnt exist.
*
* @param Message $mo
*/
public function __construct(Echomail $mo)
{
parent::__construct();
$this->mo = $mo;
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return Netmail
* @throws \Exception
*/
public function toNetmail(object $notifiable): Netmail
{
$o = $this->setupNetmail($notifiable);
$ao = $notifiable->routeNotificationFor(static::via);
Log::info(sprintf('%s:+ Creating ECHOAREA NOT EXIST netmail to [%s]',self::LOGKEY,$ao->ftn));
$o->to = $this->mo->from;
$o->subject = 'Echoarea doesnt exist - '.$this->mo->set->get('set_echoarea');
// Message
$msg = $this->page(FALSE,'nothere');
$msg->addText($this->sourceSummary($this->mo)."\r\r");
$msg->addText(sprintf("It appears that the echoarea [%s] that this message is for doesnt exist, so the message from your system was rejected.\r\r",$this->mo->set->get('set_echoarea')));
$msg->addText("Please contact the ZC if you think this is a mistake.\r\r");
$msg->addText($this->message_path($this->mo));
$o->msg = $msg->render();
$o->set_tagline = 'Don\'t let your trash become someone else\'s treasure. Feed your shredder often.';
$o->save();
return $o;
}
}