When de-listing, remove unsent items and unsubscribe from file/echo areas.
This commit is contained in:
parent
7e0178d183
commit
b6639c7bfc
@ -13,7 +13,8 @@ use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
|
||||
use App\Models\{Address,Domain,Echoarea};
|
||||
use App\Classes\FTN\Message;
|
||||
use App\Models\{Address,Domain};
|
||||
use App\Notifications\Echomails\AbsentNodes;
|
||||
use App\Notifications\Emails\NodeMarkedDown as NodeMarkedDownEmail;
|
||||
use App\Notifications\Netmails\NodeMarkedDown as NodeMarkedDownNetmail;
|
||||
@ -57,8 +58,34 @@ class AddressIdle implements ShouldQueue
|
||||
Log::info(sprintf('%s:- Delisting [%s], not seen for [%d] days',self::LOGKEY,$ao->ftn,config('fido.idle.delist')));
|
||||
$contact = FALSE;
|
||||
|
||||
// @todo Subscribe from echoareas/fileareas
|
||||
// Remove echomail not collected from echomail_seenby
|
||||
DB::table('echomail_seenby')
|
||||
->where('address_id',$ao->id)
|
||||
->whereNotNull('export_at')
|
||||
->whereNull('sent_at')
|
||||
->delete();
|
||||
|
||||
// Remove FLAG_INTRANSIT from netmail that hasnt been delivered
|
||||
DB::table('netmails')
|
||||
->where('tftn_id',$ao->id)
|
||||
->whereRaw(sprintf('(flags & %d) > 0',Message::FLAG_INTRANSIT))
|
||||
->update(['flags'=>DB::raw(sprintf('(flags & ~%d)',Message::FLAG_INTRANSIT))]);
|
||||
|
||||
// Remove files not collected
|
||||
DB::table('file_seenby')
|
||||
->where('address_id',$ao->id)
|
||||
->whereNotNull('export_at')
|
||||
->whereNull('sent_at')
|
||||
->delete();
|
||||
|
||||
// Remove subscribed echoareas
|
||||
$ao->echoareas()->detach();
|
||||
|
||||
// Remove subscribed fileareas
|
||||
$ao->fileareas()->detach();
|
||||
|
||||
$ao->active = FALSE;
|
||||
$ao->validated = FALSE;
|
||||
$ao->save();
|
||||
|
||||
// Email Alert
|
||||
|
Loading…
Reference in New Issue
Block a user