Change our mail packet name to be the youngest ID in the packet, not the youngest date
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 43s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m52s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s

This commit is contained in:
2024-09-09 11:50:41 +10:00
parent e6c0511b33
commit 75f5424d4f
3 changed files with 17 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Classes\File;
use Carbon\Carbon;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
@@ -36,13 +37,13 @@ final class Mail extends Send
return $this->f->messages->pluck('id');
case 'name':
return sprintf('%08x',timew($this->youngest()));
return sprintf('%08x',$this->youngest_id());
case 'nameas':
return sprintf('%s.pkt',$this->name);
case 'mtime':
return $this->youngest()->timestamp;
return $this->youngest_date()->timestamp;
case 'type':
return ($this->ftype&0xff00)>>8;
@@ -114,8 +115,18 @@ final class Mail extends Send
return TRUE;
}
private function youngest(): Carbon
private function youngest(): array
{
return $this->f->messages->pluck('date')->sort()->last();
return $this->f->messages->sortBy(fn($item)=>Arr::get($item,'datetime'))->first();
}
private function youngest_id(): int
{
return Arr::get($this->youngest(),'id',0);
}
private function youngest_date(): Carbon
{
return Arr::get($this->youngest(),'datetime',Carbon::now());
}
}