|
|
@ -122,11 +122,15 @@ class SearchApiV2Service
|
|
|
|
protected function hashtags()
|
|
|
|
protected function hashtags()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$mastodonMode = self::$mastodonMode;
|
|
|
|
$mastodonMode = self::$mastodonMode;
|
|
|
|
|
|
|
|
$q = $this->query->input('q');
|
|
|
|
$limit = $this->query->input('limit') ?? 20;
|
|
|
|
$limit = $this->query->input('limit') ?? 20;
|
|
|
|
$offset = $this->query->input('offset') ?? 0;
|
|
|
|
$offset = $this->query->input('offset') ?? 0;
|
|
|
|
$query = $this->query->input('q') . '%';
|
|
|
|
$query = Str::startsWith($q, '#') ? substr($q, 1) . '%' : $q . '%';
|
|
|
|
return Hashtag::where('can_search', true)
|
|
|
|
return Hashtag::where('name', 'like', $query)
|
|
|
|
->where('name', 'like', $query)
|
|
|
|
->where(function($q) {
|
|
|
|
|
|
|
|
return $q->where('can_search', true)
|
|
|
|
|
|
|
|
->orWhereNull('can_search');
|
|
|
|
|
|
|
|
})
|
|
|
|
->offset($offset)
|
|
|
|
->offset($offset)
|
|
|
|
->limit($limit)
|
|
|
|
->limit($limit)
|
|
|
|
->get()
|
|
|
|
->get()
|
|
|
|