Update StatusPipeline, fix Direct and Story notification deletion

This commit is contained in:
Daniel Supernault 2023-12-08 04:44:45 -07:00
parent 9818656425
commit 4c95306f12
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1
2 changed files with 46 additions and 4 deletions

View file

@ -40,6 +40,7 @@ use App\Services\CollectionService;
use App\Services\StatusService;
use App\Jobs\MediaPipeline\MediaDeletePipeline;
use App\Jobs\ProfilePipeline\DecrementPostCount;
use App\Services\NotificationService;
class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
{
@ -137,14 +138,34 @@ class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
CollectionService::removeItem($col->collection_id, $col->object_id);
$col->delete();
});
DirectMessage::whereStatusId($status->id)->delete();
$dms = DirectMessage::whereStatusId($status->id)->get();
foreach($dms as $dm) {
$not = Notification::whereItemType('App\DirectMessage')
->whereItemId($dm->id)
->first();
if($not) {
NotificationService::del($not->profile_id, $not->id);
$not->forceDeleteQuietly();
}
$dm->delete();
}
Like::whereStatusId($status->id)->forceDelete();
Media::whereStatusId($status->id)
->get()
->each(function($media) {
MediaDeletePipeline::dispatch($media)->onQueue('mmo');
});
MediaTag::where('status_id', $status->id)->delete();
$mediaTags = MediaTag::where('status_id', $status->id)->get();
foreach($mediaTags as $mtag) {
$not = Notification::whereItemType('App\MediaTag')
->whereItemId($mtag->id)
->first();
if($not) {
NotificationService::del($not->profile_id, $not->id);
$not->forceDeleteQuietly();
}
$mtag->delete();
}
Mention::whereStatusId($status->id)->forceDelete();
Notification::whereItemType('App\Status')
->whereItemId($status->id)

View file

@ -35,6 +35,7 @@ use GuzzleHttp\Promise;
use App\Util\ActivityPub\HttpSignature;
use App\Services\CollectionService;
use App\Services\StatusService;
use App\Services\NotificationService;
use App\Jobs\MediaPipeline\MediaDeletePipeline;
class StatusDelete implements ShouldQueue
@ -115,10 +116,30 @@ class StatusDelete implements ShouldQueue
$col->delete();
});
DirectMessage::whereStatusId($status->id)->delete();
$dms = DirectMessage::whereStatusId($status->id)->get();
foreach($dms as $dm) {
$not = Notification::whereItemType('App\DirectMessage')
->whereItemId($dm->id)
->first();
if($not) {
NotificationService::del($not->profile_id, $not->id);
$not->forceDeleteQuietly();
}
$dm->delete();
}
Like::whereStatusId($status->id)->delete();
MediaTag::where('status_id', $status->id)->delete();
$mediaTags = MediaTag::where('status_id', $status->id)->get();
foreach($mediaTags as $mtag) {
$not = Notification::whereItemType('App\MediaTag')
->whereItemId($mtag->id)
->first();
if($not) {
NotificationService::del($not->profile_id, $not->id);
$not->forceDeleteQuietly();
}
$mtag->delete();
}
Mention::whereStatusId($status->id)->forceDelete();
Notification::whereItemType('App\Status')