Improvements for finding intransit netmails to upstream and peer hubs
This commit is contained in:
@@ -1193,10 +1193,17 @@ class Address extends Model
|
||||
*/
|
||||
public function netmailWaiting(): Builder
|
||||
{
|
||||
// Addresses that our downstream of this address, except anybody that has session details with us
|
||||
$ours = our_nodes($this->zone->domain)->pluck('id');
|
||||
|
||||
$addresses = $this->downstream()
|
||||
->filter(fn($item)=>! $ours->contains($item->id))
|
||||
->merge($this->system->match($this->zone,Address::NODE_ALL));
|
||||
|
||||
$netmails = $this
|
||||
->UncollectedNetmail()
|
||||
->select('netmails.id')
|
||||
->whereIn('addresses.id',$this->downlinks()->add($this)->pluck('id'))
|
||||
->whereIn('addresses.id',$addresses->pluck('id'))
|
||||
->groupBy(['netmails.id'])
|
||||
->get();
|
||||
|
||||
|
Reference in New Issue
Block a user