diff --git a/app/Services/SearchApiV2Service.php b/app/Services/SearchApiV2Service.php index fdda0da07..ffebb2e40 100644 --- a/app/Services/SearchApiV2Service.php +++ b/app/Services/SearchApiV2Service.php @@ -149,6 +149,9 @@ class SearchApiV2Service ->get() ->map(function($status) { return StatusService::get($status->id); + }) + ->filter(function($status) { + return $status && isset($status['account']); }); return $results; } @@ -188,6 +191,7 @@ class SearchApiV2Service try { $res = ActivityPubFetchService::get($query); + $banned = InstanceService::getBannedDomains(); if($res) { $json = json_decode($res, true); @@ -202,10 +206,14 @@ class SearchApiV2Service switch($json['type']) { case 'Note': $obj = Helpers::statusFetch($query); - if(!$obj) { + if(!$obj || !isset($obj['id'])) { return $default; } - $default['statuses'][] = StatusService::get($obj['id']); + $note = StatusService::get($obj['id']); + if(!$note) { + return $default; + } + $default['statuses'][] = $note; return $default; break; @@ -214,6 +222,9 @@ class SearchApiV2Service if(!$obj) { return $default; } + if(in_array($obj['domain'], $banned)) { + return $default; + } $default['accounts'][] = AccountService::get($obj['id']); return $default; break;