Store datetime in UTC format now, and fix presentation of TZUTC. Also standardise message summaries on Notifications
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

This commit is contained in:
2024-06-28 23:27:06 +10:00
parent fc930ba6c2
commit 4d7af7c7e3
17 changed files with 51 additions and 58 deletions

View File

@@ -8,7 +8,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use App\Classes\FTN\Message;
use App\Models\{Echoarea,Echomail,Setup};
use App\Models\{Echoarea,Echomail,Netmail,Setup};
abstract class Echomails extends Notification //implements ShouldQueue
{
@@ -53,8 +53,8 @@ abstract class Echomails extends Notification //implements ShouldQueue
$o->echoarea_id = $eo->id;
$o->datetime = Carbon::now();
$o->tzoffset = $o->datetime->utcOffset();
$o->datetime = Carbon::now()->utc();
$o->tzoffset = Carbon::now()->utcOffset();
$o->flags = (Message::FLAG_LOCAL);
@@ -62,4 +62,13 @@ abstract class Echomails extends Notification //implements ShouldQueue
return $o;
}
protected function sourceSummary(Echomail|Netmail $o,string $item=NULL): string
{
return sprintf("Your %s was received here on [%s] and it looks like you sent it on [%s].",
$item ?: sprintf('%s with ID [%s] to [%s]',$o instanceof Netmail ? 'Netmail' : 'Echomail',$o->msgid,$o->to),
Carbon::now()->utc()->toDateTimeString(),
$o->date->utc()->toDateTimeString(),
);
}
}

View File

@@ -8,7 +8,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use App\Classes\FTN\Message;
use App\Models\{Netmail,Setup,System};
use App\Models\{Echomail,Netmail,Setup};
abstract class Netmails extends Notification //implements ShouldQueue
{
@@ -57,8 +57,8 @@ abstract class Netmails extends Notification //implements ShouldQueue
$o->to = $ao->system->sysop;
$o->from = Setup::PRODUCT_NAME;
$o->datetime = Carbon::now();
$o->tzoffset = $o->datetime->utcOffset();
$o->datetime = Carbon::now()->utc();
$o->tzoffset = Carbon::now()->utcOffset();
$o->fftn_id = our_address($ao)->id;
$o->tftn_id = $ao->id;
@@ -69,4 +69,13 @@ abstract class Netmails extends Notification //implements ShouldQueue
return $o;
}
protected function sourceSummary(Echomail|Netmail $o,string $item=NULL): string
{
return sprintf("Your %s was received here on [%s] and it looks like you sent it on [%s].",
$item ?: sprintf('%s with ID [%s] to [%s]',$o instanceof Netmail ? 'Netmail' : 'Echomail',$o->msgid,$o->to),
Carbon::now()->utc()->toDateTimeString(),
$o->date->utc()->toDateTimeString(),
);
}
}

View File

@@ -48,14 +48,7 @@ class EchoareaNoWrite extends Netmails
// Message
$msg = $this->page(FALSE,'nowrite');
$msg->addText(
sprintf("Your echomail with ID [%s] to [%s] here was received here on [%s] and it looks like you sent it on [%s].\r\r",
$this->mo->msgid,
$this->mo->to,
Carbon::now()->utc()->toDateTimeString(),
$this->mo->date->utc()->toDateTimeString(),
)
);
$msg->addText($this->sourceSummary($this->mo)."\r\r");
$msg->addText(sprintf("It appears that you do not have permission to post in [%s] using the address [%s], so the message from your system was rejected.\r\r",$this->mo->echoarea->name,$ao->ftn));
$msg->addText("Please contact the ZC if you think this is a mistake.\r\r");

View File

@@ -50,14 +50,7 @@ class EchoareaNotExist extends Netmails
// Message
$msg = $this->page(FALSE,'nothere');
$msg->addText(
sprintf("Your echomail with ID [%s] to [%s] here was received here on [%s] and it looks like you sent it on [%s].\r\r",
$this->mo->msgid,
$this->mo->to,
Carbon::now()->utc()->toDateTimeString(),
$this->mo->date->utc()->toDateTimeString(),
)
);
$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");

View File

@@ -48,14 +48,7 @@ class EchoareaNotSubscribed extends Netmails
// Message
$msg = $this->page(FALSE,'nosub');
$msg->addText(
sprintf("Your echomail with ID [%s] to [%s] here was received here on [%s] and it looks like you sent it on [%s].\r\r",
$this->mo->msgid,
$this->mo->to,
Carbon::now()->utc()->toDateTimeString(),
$this->mo->date->utc()->toDateTimeString(),
)
);
$msg->addText($this->sourceSummary($this->mo)."\r\r");
$msg->addText(sprintf("It appears that you havent been previously subscribed to this echoarea using the address [%s].\r\r",$ao->ftn));

View File

@@ -48,14 +48,7 @@ class EchomailBadAddress extends Netmails
// Message
$msg = $this->page(FALSE,'badmsg');
$msg->addText(
sprintf("Your echomail with ID [%s] to [%s] here was received here on [%s] and it looks like you sent it on [%s].\r\r",
$this->mo->msgid,
$this->mo->to,
Carbon::now()->utc()->toDateTimeString(),
$this->mo->date->utc()->toDateTimeString(),
)
);
$msg->addText($this->sourceSummary($this->mo)."\r\r");
$msg->addText(sprintf("The address in this echomail [%s] is the wrong address for this domain [%s].\r\r",$this->mo->fftn,$ao->zone->domain->name));

View File

@@ -50,14 +50,7 @@ class NetmailHubNoUser extends Netmails
// Message
$msg = $this->page(FALSE,'Reject');
$msg->addText(
sprintf("Your netmail with ID [%s] to [%s] here was received here on [%s] and it looks like you sent it on [%s].\r\r",
$this->mo->msgid,
$this->mo->to,
Carbon::now()->utc()->toDateTimeString(),
$this->mo->date->utc()->toDateTimeString(),
)
);
$msg->addText($this->sourceSummary($this->mo)."\r\r");
$msg->addText("This hub is not attended, so no user will be able to read your message. You may like to try and contact them another way.\r\r");