mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-23 13:00:46 +00:00
Update search service, fix banned instance edge case
This commit is contained in:
parent
dfcd2e6d2a
commit
74018e9c4e
1 changed files with 13 additions and 2 deletions
|
@ -149,6 +149,9 @@ class SearchApiV2Service
|
||||||
->get()
|
->get()
|
||||||
->map(function($status) {
|
->map(function($status) {
|
||||||
return StatusService::get($status->id);
|
return StatusService::get($status->id);
|
||||||
|
})
|
||||||
|
->filter(function($status) {
|
||||||
|
return $status && isset($status['account']);
|
||||||
});
|
});
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
@ -188,6 +191,7 @@ class SearchApiV2Service
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$res = ActivityPubFetchService::get($query);
|
$res = ActivityPubFetchService::get($query);
|
||||||
|
$banned = InstanceService::getBannedDomains();
|
||||||
if($res) {
|
if($res) {
|
||||||
$json = json_decode($res, true);
|
$json = json_decode($res, true);
|
||||||
|
|
||||||
|
@ -202,10 +206,14 @@ class SearchApiV2Service
|
||||||
switch($json['type']) {
|
switch($json['type']) {
|
||||||
case 'Note':
|
case 'Note':
|
||||||
$obj = Helpers::statusFetch($query);
|
$obj = Helpers::statusFetch($query);
|
||||||
if(!$obj) {
|
if(!$obj || !isset($obj['id'])) {
|
||||||
return $default;
|
return $default;
|
||||||
}
|
}
|
||||||
$default['statuses'][] = StatusService::get($obj['id']);
|
$note = StatusService::get($obj['id']);
|
||||||
|
if(!$note) {
|
||||||
|
return $default;
|
||||||
|
}
|
||||||
|
$default['statuses'][] = $note;
|
||||||
return $default;
|
return $default;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -214,6 +222,9 @@ class SearchApiV2Service
|
||||||
if(!$obj) {
|
if(!$obj) {
|
||||||
return $default;
|
return $default;
|
||||||
}
|
}
|
||||||
|
if(in_array($obj['domain'], $banned)) {
|
||||||
|
return $default;
|
||||||
|
}
|
||||||
$default['accounts'][] = AccountService::get($obj['id']);
|
$default['accounts'][] = AccountService::get($obj['id']);
|
||||||
return $default;
|
return $default;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue