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