Update StatusDelete pipeline

This commit is contained in:
Daniel Supernault 2022-12-30 21:05:34 -07:00
parent 63f723decb
commit 52879826fa
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -74,11 +74,12 @@ class StatusDelete implements ShouldQueue
$profile = $this->status->profile; $profile = $this->status->profile;
StatusService::del($status->id, true); StatusService::del($status->id, true);
if($profile) {
if(in_array($status->type, ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])) { if(in_array($status->type, ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])) {
$profile->status_count = $profile->status_count - 1; $profile->status_count = $profile->status_count - 1;
$profile->save(); $profile->save();
} }
}
if(config_cache('federation.activitypub.enabled') == true) { if(config_cache('federation.activitypub.enabled') == true) {
return $this->fanoutDelete($status); return $this->fanoutDelete($status);
@ -144,6 +145,10 @@ class StatusDelete implements ShouldQueue
$audience = $status->profile->getAudienceInbox(); $audience = $status->profile->getAudienceInbox();
$profile = $status->profile; $profile = $status->profile;
if(!$profile) {
return;
}
$fractal = new Fractal\Manager(); $fractal = new Fractal\Manager();
$fractal->setSerializer(new ArraySerializer()); $fractal->setSerializer(new ArraySerializer());
$resource = new Fractal\Resource\Item($status, new DeleteNote()); $resource = new Fractal\Resource\Item($status, new DeleteNote());