Add DBID back to messages, add path/seen-by to generated messages, other minor cosmetic fixes

This commit is contained in:
Deon George
2022-01-22 23:08:46 +11:00
parent fe9fbb88b0
commit efa7195633
8 changed files with 137 additions and 11 deletions

View File

@@ -159,4 +159,28 @@ if (! function_exists('dwtime')) {
return \Carbon\Carbon::create($year,$month,$day,$hr,$min,$sec+$milli/10);
}
}
if (! function_exists('optimize_path')) {
/**
* This will optimize an array of paths to show the smallest number of characters
*/
function optimize_path(\Illuminate\Support\Collection $path): \Illuminate\Support\Collection
{
$cur = NULL;
$result = collect();
foreach ($path as $address) {
[$host,$node] = explode('/',$address);
if ($host !== $cur) {
$cur = $host;
$result->push($address);
} else {
$result->push($node);
}
}
return $result;
}
}