Update ApiController, return status object after deletion

This commit is contained in:
Daniel Supernault 2020-12-09 21:34:43 -07:00
parent db646026be
commit 0718711d09
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -1761,6 +1761,7 @@ class ApiV1Controller extends Controller
NewStatusPipeline::dispatch($status);
Cache::forget('user:account:id:'.$user->id);
Cache::forget('_api:statuses:recent_9:'.$user->profile_id);
Cache::forget('profile:status_count:'.$user->profile_id);
Cache::forget($user->storageUsedKey());
@ -1783,10 +1784,15 @@ class ApiV1Controller extends Controller
$status = Status::whereProfileId($request->user()->profile->id)
->findOrFail($id);
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
Cache::forget('profile:status_count:'.$status->profile_id);
StatusDelete::dispatch($status);
return response()->json(['Status successfully deleted.']);
$res = $this->fractal->createData($resource)->toArray();
$res['text'] = $res['content'];
unset($res['content']);
return response()->json($res);
}
/**