|
|
|
@ -2,47 +2,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
namespace App\Jobs\StatusPipeline;
|
|
|
|
namespace App\Jobs\StatusPipeline;
|
|
|
|
|
|
|
|
|
|
|
|
use DB, Cache, Storage;
|
|
|
|
use App\AccountInterstitial;
|
|
|
|
use App\{
|
|
|
|
use App\Bookmark;
|
|
|
|
AccountInterstitial,
|
|
|
|
use App\CollectionItem;
|
|
|
|
Bookmark,
|
|
|
|
use App\DirectMessage;
|
|
|
|
CollectionItem,
|
|
|
|
use App\Jobs\MediaPipeline\MediaDeletePipeline;
|
|
|
|
DirectMessage,
|
|
|
|
use App\Like;
|
|
|
|
Like,
|
|
|
|
use App\Media;
|
|
|
|
Media,
|
|
|
|
use App\MediaTag;
|
|
|
|
MediaTag,
|
|
|
|
use App\Mention;
|
|
|
|
Mention,
|
|
|
|
use App\Notification;
|
|
|
|
Notification,
|
|
|
|
use App\Report;
|
|
|
|
Report,
|
|
|
|
use App\Services\Account\AccountStatService;
|
|
|
|
Status,
|
|
|
|
use App\Services\AccountService;
|
|
|
|
StatusArchived,
|
|
|
|
use App\Services\CollectionService;
|
|
|
|
StatusHashtag,
|
|
|
|
use App\Services\NotificationService;
|
|
|
|
StatusView
|
|
|
|
use App\Services\StatusService;
|
|
|
|
};
|
|
|
|
use App\Status;
|
|
|
|
|
|
|
|
use App\StatusArchived;
|
|
|
|
|
|
|
|
use App\StatusHashtag;
|
|
|
|
|
|
|
|
use App\StatusView;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
|
|
|
|
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
|
|
|
|
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
|
|
|
|
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
|
|
|
|
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
|
|
|
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
|
|
|
use League\Fractal;
|
|
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
use Illuminate\Support\Str;
|
|
|
|
|
|
|
|
use League\Fractal\Serializer\ArraySerializer;
|
|
|
|
|
|
|
|
use App\Transformer\ActivityPub\Verb\DeleteNote;
|
|
|
|
|
|
|
|
use App\Util\ActivityPub\Helpers;
|
|
|
|
|
|
|
|
use GuzzleHttp\Pool;
|
|
|
|
|
|
|
|
use GuzzleHttp\Client;
|
|
|
|
|
|
|
|
use GuzzleHttp\Promise;
|
|
|
|
|
|
|
|
use App\Util\ActivityPub\HttpSignature;
|
|
|
|
|
|
|
|
use App\Services\AccountService;
|
|
|
|
|
|
|
|
use App\Services\CollectionService;
|
|
|
|
|
|
|
|
use App\Services\StatusService;
|
|
|
|
|
|
|
|
use App\Jobs\MediaPipeline\MediaDeletePipeline;
|
|
|
|
|
|
|
|
use App\Services\NotificationService;
|
|
|
|
|
|
|
|
use App\Services\Account\AccountStatService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
|
|
|
class RemoteStatusDelete implements ShouldBeUniqueUntilProcessing, ShouldQueue
|
|
|
|
{
|
|
|
|
{
|
|
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
|
|
|
|
|
|
|
|
@ -56,8 +44,11 @@ class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
|
|
|
public $deleteWhenMissingModels = true;
|
|
|
|
public $deleteWhenMissingModels = true;
|
|
|
|
|
|
|
|
|
|
|
|
public $tries = 3;
|
|
|
|
public $tries = 3;
|
|
|
|
|
|
|
|
|
|
|
|
public $maxExceptions = 3;
|
|
|
|
public $maxExceptions = 3;
|
|
|
|
|
|
|
|
|
|
|
|
public $timeout = 180;
|
|
|
|
public $timeout = 180;
|
|
|
|
|
|
|
|
|
|
|
|
public $failOnTimeout = true;
|
|
|
|
public $failOnTimeout = true;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@ -72,7 +63,7 @@ class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function uniqueId(): string
|
|
|
|
public function uniqueId(): string
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return 'status:remote:delete:' . $this->status->id;
|
|
|
|
return 'status:remote:delete:'.$this->status->id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@ -104,11 +95,12 @@ class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$status = $this->status;
|
|
|
|
$status = $this->status;
|
|
|
|
|
|
|
|
|
|
|
|
if($status->deleted_at) {
|
|
|
|
if ($status->deleted_at) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StatusService::del($status->id, true);
|
|
|
|
StatusService::del($status->id, true);
|
|
|
|
|
|
|
|
|
|
|
|
// AccountStatService::decrementPostCount($status->profile_id);
|
|
|
|
// AccountStatService::decrementPostCount($status->profile_id);
|
|
|
|
return $this->unlinkRemoveMedia($status);
|
|
|
|
return $this->unlinkRemoveMedia($status);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -116,11 +108,13 @@ class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
|
|
|
public function unlinkRemoveMedia($status)
|
|
|
|
public function unlinkRemoveMedia($status)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if($status->in_reply_to_id) {
|
|
|
|
if ($status->in_reply_to_id) {
|
|
|
|
$parent = Status::find($status->in_reply_to_id);
|
|
|
|
$parent = Status::find($status->in_reply_to_id);
|
|
|
|
if($parent) {
|
|
|
|
if ($parent) {
|
|
|
|
--$parent->reply_count;
|
|
|
|
if ($parent->reply_count) {
|
|
|
|
$parent->save();
|
|
|
|
$parent->reply_count = $parent->reply_count - 1;
|
|
|
|
|
|
|
|
$parent->save();
|
|
|
|
|
|
|
|
}
|
|
|
|
StatusService::del($parent->id);
|
|
|
|
StatusService::del($parent->id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -132,16 +126,16 @@ class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
|
|
|
CollectionItem::whereObjectType('App\Status')
|
|
|
|
CollectionItem::whereObjectType('App\Status')
|
|
|
|
->whereObjectId($status->id)
|
|
|
|
->whereObjectId($status->id)
|
|
|
|
->get()
|
|
|
|
->get()
|
|
|
|
->each(function($col) {
|
|
|
|
->each(function ($col) {
|
|
|
|
CollectionService::removeItem($col->collection_id, $col->object_id);
|
|
|
|
CollectionService::removeItem($col->collection_id, $col->object_id);
|
|
|
|
$col->delete();
|
|
|
|
$col->delete();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$dms = DirectMessage::whereStatusId($status->id)->get();
|
|
|
|
$dms = DirectMessage::whereStatusId($status->id)->get();
|
|
|
|
foreach($dms as $dm) {
|
|
|
|
foreach ($dms as $dm) {
|
|
|
|
$not = Notification::whereItemType('App\DirectMessage')
|
|
|
|
$not = Notification::whereItemType('App\DirectMessage')
|
|
|
|
->whereItemId($dm->id)
|
|
|
|
->whereItemId($dm->id)
|
|
|
|
->first();
|
|
|
|
->first();
|
|
|
|
if($not) {
|
|
|
|
if ($not) {
|
|
|
|
NotificationService::del($not->profile_id, $not->id);
|
|
|
|
NotificationService::del($not->profile_id, $not->id);
|
|
|
|
$not->forceDeleteQuietly();
|
|
|
|
$not->forceDeleteQuietly();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -149,16 +143,16 @@ class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$mediaTags = MediaTag::where('status_id', $status->id)->get();
|
|
|
|
$mediaTags = MediaTag::where('status_id', $status->id)->get();
|
|
|
|
foreach($mediaTags as $mtag) {
|
|
|
|
foreach ($mediaTags as $mtag) {
|
|
|
|
$not = Notification::whereItemType('App\MediaTag')
|
|
|
|
$not = Notification::whereItemType('App\MediaTag')
|
|
|
|
->whereItemId($mtag->id)
|
|
|
|
->whereItemId($mtag->id)
|
|
|
|
->first();
|
|
|
|
->first();
|
|
|
|
if($not) {
|
|
|
|
if ($not) {
|
|
|
|
NotificationService::del($not->profile_id, $not->id);
|
|
|
|
NotificationService::del($not->profile_id, $not->id);
|
|
|
|
$not->forceDeleteQuietly();
|
|
|
|
$not->forceDeleteQuietly();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|