Detect when we dont have an address in a domain, and pick the first domain address even if we are not in the zone.
This commit is contained in:
parent
e28e17866e
commit
3f7f04c382
@ -205,6 +205,10 @@ final class Echomail extends Model implements Packet
|
|||||||
$o->origin = $this->origin;
|
$o->origin = $this->origin;
|
||||||
|
|
||||||
$sysaddress = Setup::findOrFail(config('app.id'))->system->match($this->fftn->zone)->first();
|
$sysaddress = Setup::findOrFail(config('app.id'))->system->match($this->fftn->zone)->first();
|
||||||
|
|
||||||
|
if (! $sysaddress)
|
||||||
|
throw new \Exception(sprintf('%s:! We dont have an address in this network? (%s)',self::LOGKEY,$this->fftn->zone->domain->name));
|
||||||
|
|
||||||
$o->seenby = $this->seenby->push($sysaddress)->unique()->pluck('ftn2d');
|
$o->seenby = $this->seenby->push($sysaddress)->unique()->pluck('ftn2d');
|
||||||
|
|
||||||
// Add our address to the path and seenby
|
// Add our address to the path and seenby
|
||||||
|
@ -195,7 +195,9 @@ class System extends Model
|
|||||||
public function match(Zone $o,int $type=(Address::NODE_NC|Address::NODE_HC|Address::NODE_ACTIVE|Address::NODE_PVT|Address::NODE_POINT)): Collection
|
public function match(Zone $o,int $type=(Address::NODE_NC|Address::NODE_HC|Address::NODE_ACTIVE|Address::NODE_PVT|Address::NODE_POINT)): Collection
|
||||||
{
|
{
|
||||||
return $this->akas
|
return $this->akas
|
||||||
->where('zone_id',$o->id)
|
->where(function($item) use($o) {
|
||||||
|
return ($item->zone_id === $o->id) || ($item->zone->domain_id === $o->domain_id);
|
||||||
|
})
|
||||||
->filter(function($item) use ($type) {
|
->filter(function($item) use ($type) {
|
||||||
return $item->role & $type;
|
return $item->role & $type;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user