forked from mirror/pixelfed
Update StatusPipeline
This commit is contained in:
parent
03bc9ce466
commit
0ce65865c6
1 changed files with 26 additions and 17 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Jobs\StatusPipeline;
|
namespace App\Jobs\StatusPipeline;
|
||||||
|
|
||||||
|
use DB;
|
||||||
use App\{
|
use App\{
|
||||||
Notification,
|
Notification,
|
||||||
Report,
|
Report,
|
||||||
|
@ -79,24 +80,32 @@ class StatusDelete implements ShouldQueue
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$comments = Status::where('in_reply_to_id', $status->id)->get();
|
if($status->in_reply_to_id) {
|
||||||
foreach ($comments as $comment) {
|
DB::transaction(function() use($status) {
|
||||||
$comment->in_reply_to_id = null;
|
$parent = Status::findOrFail($status->in_reply_to_id);
|
||||||
$comment->save();
|
--$parent->reply_count;
|
||||||
Notification::whereItemType('App\Status')
|
$parent->save();
|
||||||
->whereItemId($comment->id)
|
});
|
||||||
->delete();
|
|
||||||
}
|
}
|
||||||
|
DB::transaction(function() use($status) {
|
||||||
$status->likes()->delete();
|
$comments = Status::where('in_reply_to_id', $status->id)->get();
|
||||||
Notification::whereItemType('App\Status')
|
foreach ($comments as $comment) {
|
||||||
->whereItemId($status->id)
|
$comment->in_reply_to_id = null;
|
||||||
->delete();
|
$comment->save();
|
||||||
StatusHashtag::whereStatusId($status->id)->delete();
|
Notification::whereItemType('App\Status')
|
||||||
Report::whereObjectType('App\Status')
|
->whereItemId($comment->id)
|
||||||
->whereObjectId($status->id)
|
->delete();
|
||||||
->delete();
|
}
|
||||||
$status->delete();
|
$status->likes()->delete();
|
||||||
|
Notification::whereItemType('App\Status')
|
||||||
|
->whereItemId($status->id)
|
||||||
|
->delete();
|
||||||
|
StatusHashtag::whereStatusId($status->id)->delete();
|
||||||
|
Report::whereObjectType('App\Status')
|
||||||
|
->whereObjectId($status->id)
|
||||||
|
->delete();
|
||||||
|
$status->delete();
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue