mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 16:44:50 +00:00
commit
7e2bad3df6
4 changed files with 5 additions and 19 deletions
|
@ -96,9 +96,10 @@ class SearchApiV2Service
|
||||||
$webfingerQuery = '@' . $webfingerQuery;
|
$webfingerQuery = '@' . $webfingerQuery;
|
||||||
}
|
}
|
||||||
$banned = InstanceService::getBannedDomains();
|
$banned = InstanceService::getBannedDomains();
|
||||||
|
$operator = config('database.default') === 'pgsql' ? 'ilike' : 'like';
|
||||||
$results = Profile::select('username', 'id', 'followers_count', 'domain')
|
$results = Profile::select('username', 'id', 'followers_count', 'domain')
|
||||||
->where('username', 'like', $query)
|
->where('username', $operator, $query)
|
||||||
->orWhere('webfinger', 'like', $webfingerQuery)
|
->orWhere('webfinger', $operator, $webfingerQuery)
|
||||||
->orderByDesc('profiles.followers_count')
|
->orderByDesc('profiles.followers_count')
|
||||||
->offset($offset)
|
->offset($offset)
|
||||||
->limit($limit)
|
->limit($limit)
|
||||||
|
@ -160,23 +161,8 @@ class SearchApiV2Service
|
||||||
|
|
||||||
protected function statusesById()
|
protected function statusesById()
|
||||||
{
|
{
|
||||||
$mastodonMode = self::$mastodonMode;
|
// Removed until we provide more relevent sorting/results
|
||||||
$accountId = $this->query->input('account_id');
|
return [];
|
||||||
$limit = $this->query->input('limit', 20);
|
|
||||||
$query = '%' . $this->query->input('q') . '%';
|
|
||||||
$results = Status::where('caption', 'like', $query)
|
|
||||||
->whereProfileId($accountId)
|
|
||||||
->limit($limit)
|
|
||||||
->get()
|
|
||||||
->map(function($status) use($mastodonMode) {
|
|
||||||
return $mastodonMode ?
|
|
||||||
StatusService::getMastodon($status->id) :
|
|
||||||
StatusService::get($status->id);
|
|
||||||
})
|
|
||||||
->filter(function($status) {
|
|
||||||
return $status && isset($status['account']);
|
|
||||||
});
|
|
||||||
return $results;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function resolveQuery()
|
protected function resolveQuery()
|
||||||
|
|
BIN
public/js/spa.js
vendored
BIN
public/js/spa.js
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 6.8 KiB |
Loading…
Reference in a new issue