Added no_export option to stop a message from being exported when saved.

This commit is contained in:
Deon George 2022-01-05 09:25:36 +11:00
parent 2f720d6c26
commit 3d6f233c1d
2 changed files with 8 additions and 0 deletions

View File

@ -128,6 +128,7 @@ class ConvertMongo extends Command
$oo->set_path = $path ? array_filter($path) : []; $oo->set_path = $path ? array_filter($path) : [];
$oo->set_seenby = $seenby ? array_filter($seenby): []; $oo->set_seenby = $seenby ? array_filter($seenby): [];
$oo->set_packet = $packet; $oo->set_packet = $packet;
$oo->no_export = TRUE;
try { try {
$oo->save(['timestamps'=>FALSE]); $oo->save(['timestamps'=>FALSE]);

View File

@ -20,6 +20,7 @@ final class Echomail extends Model implements Packet
private array $set_seenby = []; private array $set_seenby = [];
private array $set_path = []; private array $set_path = [];
private ?string $set_packet = NULL; private ?string $set_packet = NULL;
private bool $no_export = FALSE;
protected $casts = [ protected $casts = [
'kludges' => 'json', 'kludges' => 'json',
@ -42,6 +43,7 @@ final class Echomail extends Model implements Packet
public function __set($key, $value) public function __set($key, $value)
{ {
switch ($key) { switch ($key) {
case 'no_export':
case 'set_path': case 'set_path':
case 'set_packet': case 'set_packet':
case 'set_seenby': case 'set_seenby':
@ -89,6 +91,11 @@ final class Echomail extends Model implements Packet
$exportto = $model->echoarea->addresses->pluck('id')->diff($model->set_seenby); $exportto = $model->echoarea->addresses->pluck('id')->diff($model->set_seenby);
if ($exportto->count()) { if ($exportto->count()) {
if ($model->no_export) {
Log::debug(sprintf('%s:- NOT processing exporting of message by configuration [%s] to [%s]',self::LOGKEY,$model->id,$exportto->join(',')));
return;
}
Log::debug(sprintf('%s:- Exporting message [%s] to [%s]',self::LOGKEY,$model->id,$exportto->join(','))); Log::debug(sprintf('%s:- Exporting message [%s] to [%s]',self::LOGKEY,$model->id,$exportto->join(',')));
// Save the seenby for the exported systems // Save the seenby for the exported systems