mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update StatusPipeline, fix Direct and Story notification deletion
This commit is contained in:
parent
9818656425
commit
4c95306f12
2 changed files with 46 additions and 4 deletions
|
@ -40,6 +40,7 @@ use App\Services\CollectionService;
|
||||||
use App\Services\StatusService;
|
use App\Services\StatusService;
|
||||||
use App\Jobs\MediaPipeline\MediaDeletePipeline;
|
use App\Jobs\MediaPipeline\MediaDeletePipeline;
|
||||||
use App\Jobs\ProfilePipeline\DecrementPostCount;
|
use App\Jobs\ProfilePipeline\DecrementPostCount;
|
||||||
|
use App\Services\NotificationService;
|
||||||
|
|
||||||
class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
||||||
{
|
{
|
||||||
|
@ -137,14 +138,34 @@ class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
||||||
CollectionService::removeItem($col->collection_id, $col->object_id);
|
CollectionService::removeItem($col->collection_id, $col->object_id);
|
||||||
$col->delete();
|
$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();
|
Like::whereStatusId($status->id)->forceDelete();
|
||||||
Media::whereStatusId($status->id)
|
Media::whereStatusId($status->id)
|
||||||
->get()
|
->get()
|
||||||
->each(function($media) {
|
->each(function($media) {
|
||||||
MediaDeletePipeline::dispatch($media)->onQueue('mmo');
|
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();
|
Mention::whereStatusId($status->id)->forceDelete();
|
||||||
Notification::whereItemType('App\Status')
|
Notification::whereItemType('App\Status')
|
||||||
->whereItemId($status->id)
|
->whereItemId($status->id)
|
||||||
|
|
|
@ -35,6 +35,7 @@ use GuzzleHttp\Promise;
|
||||||
use App\Util\ActivityPub\HttpSignature;
|
use App\Util\ActivityPub\HttpSignature;
|
||||||
use App\Services\CollectionService;
|
use App\Services\CollectionService;
|
||||||
use App\Services\StatusService;
|
use App\Services\StatusService;
|
||||||
|
use App\Services\NotificationService;
|
||||||
use App\Jobs\MediaPipeline\MediaDeletePipeline;
|
use App\Jobs\MediaPipeline\MediaDeletePipeline;
|
||||||
|
|
||||||
class StatusDelete implements ShouldQueue
|
class StatusDelete implements ShouldQueue
|
||||||
|
@ -115,10 +116,30 @@ class StatusDelete implements ShouldQueue
|
||||||
$col->delete();
|
$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();
|
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();
|
Mention::whereStatusId($status->id)->forceDelete();
|
||||||
|
|
||||||
Notification::whereItemType('App\Status')
|
Notification::whereItemType('App\Status')
|
||||||
|
|
Loading…
Reference in a new issue