mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-26 15:03:17 +00:00
Update SearchApiV2Service, filter banned instances
This commit is contained in:
parent
4b9b969fc0
commit
281443d7fe
1 changed files with 9 additions and 1 deletions
|
@ -85,6 +85,7 @@ class SearchApiV2Service
|
|||
$limit = $this->query->input('limit') ?? 20;
|
||||
$offset = $this->query->input('offset') ?? 0;
|
||||
$query = '%' . $this->query->input('q') . '%';
|
||||
$banned = InstanceService::getBannedDomains();
|
||||
$results = Profile::select('profiles.*', 'followers.profile_id', 'followers.created_at')
|
||||
->whereNull('status')
|
||||
->leftJoin('followers', function($join) use($user) {
|
||||
|
@ -97,9 +98,16 @@ class SearchApiV2Service
|
|||
->offset($offset)
|
||||
->limit($limit)
|
||||
->get()
|
||||
->filter(function($profile) use ($banned) {
|
||||
return in_array($profile->domain, $banned) == false;
|
||||
})
|
||||
->map(function($res) {
|
||||
return AccountService::get($res['id']);
|
||||
});
|
||||
})
|
||||
->filter(function($account) {
|
||||
return $account && isset($account['id']);
|
||||
})
|
||||
->values();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue