Update ProfileController, remove actor object caching

This commit is contained in:
Daniel Supernault 2020-05-24 21:59:09 -06:00
parent 7680e771a7
commit 6e8e9a2d5e
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -171,15 +171,11 @@ class ProfileController extends Controller
{ {
abort_if(!config('federation.activitypub.enabled'), 404); abort_if(!config('federation.activitypub.enabled'), 404);
abort_if($user->domain, 404); abort_if($user->domain, 404);
$key = 'profile:ap:' . $user->id;
$ttl = now()->addMinutes(15);
return Cache::remember($key, $ttl, function() use($user) {
$fractal = new Fractal\Manager(); $fractal = new Fractal\Manager();
$resource = new Fractal\Resource\Item($user, new ProfileTransformer); $resource = new Fractal\Resource\Item($user, new ProfileTransformer);
$res = $fractal->createData($resource)->toArray(); $res = $fractal->createData($resource)->toArray();
return response(json_encode($res['data']))->header('Content-Type', 'application/activity+json'); return response(json_encode($res['data']))->header('Content-Type', 'application/activity+json');
});
} }
public function showAtomFeed(Request $request, $user) public function showAtomFeed(Request $request, $user)