Update ApiV1Controller, add StatusService del calls to update likes_count, reblogs_count and reply_count

This commit is contained in:
Daniel Supernault 2021-01-30 16:15:56 -07:00
parent aa4c718d79
commit 05b9445c8f
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -50,6 +50,7 @@ use App\Services\{
NotificationService,
MediaPathService,
SearchApiV2Service,
StatusService,
MediaBlocklistService
};
@ -856,6 +857,8 @@ class ApiV1Controller extends Controller
$status->save();
}
StatusService::del($status->id);
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
$res = $this->fractal->createData($resource)->toArray();
return response()->json($res);
@ -1766,6 +1769,7 @@ class ApiV1Controller extends Controller
$status->in_reply_to_id = $parent->id;
$status->in_reply_to_profile_id = $parent->profile_id;
$status->save();
StatusService::del($parent->id);
} else if($ids) {
if(Media::whereUserId($user->id)
->whereNull('status_id')
@ -1883,6 +1887,7 @@ class ApiV1Controller extends Controller
SharePipeline::dispatch($share);
}
StatusService::del($status->id);
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
$res = $this->fractal->createData($resource)->toArray();
return response()->json($res);
@ -1916,6 +1921,7 @@ class ApiV1Controller extends Controller
$status->reblogs_count = $status->shares()->count();
$status->save();
StatusService::del($status->id);
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
$res = $this->fractal->createData($resource)->toArray();
return response()->json($res);