1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-24 08:44:02 +00:00

Fix NotificationService bug returning html response on /api/v1/notifications endpoint when a notification id belonging to a deleted account is rendered by checking AccountService before NotificationTransformer.

This commit is contained in:
Daniel Supernault 2022-07-21 20:12:07 -06:00
parent 84961a8df6
commit 734b30e59a
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -203,13 +203,19 @@ class NotificationService {
public static function getNotification($id)
{
return Cache::remember('service:notification:'.$id, now()->addDays(3), function() use($id) {
return Cache::remember('service:notification:'.$id, 86400, function() use($id) {
$n = Notification::with('item')->find($id);
if(!$n) {
return null;
}
$account = AccountService::get($n->actor_id, true);
if(!$account) {
return null;
}
$fractal = new Fractal\Manager();
$fractal->setSerializer(new ArraySerializer());
$resource = new Fractal\Resource\Item($n, new NotificationTransformer());