mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update ApiV1Controller and DiscoverController, fix postgres hashtag search
This commit is contained in:
parent
55293e9ee6
commit
055aa6b39f
2 changed files with 15 additions and 4 deletions
|
@ -3245,9 +3245,15 @@ class ApiV1Controller extends Controller
|
|||
'limit' => 'nullable|integer|max:100'
|
||||
]);
|
||||
|
||||
if(config('database.default') === 'pgsql') {
|
||||
$tag = Hashtag::where('name', 'ilike', $hashtag)
|
||||
->orWhere('slug', 'ilike', $hashtag)
|
||||
->first();
|
||||
} else {
|
||||
$tag = Hashtag::whereName($hashtag)
|
||||
->orWhere('slug', $hashtag)
|
||||
->first();
|
||||
}
|
||||
|
||||
if(!$tag) {
|
||||
return response()->json([]);
|
||||
|
|
|
@ -61,7 +61,12 @@ class DiscoverController extends Controller
|
|||
$end = $page > 1 ? $page * 9 : 0;
|
||||
$tag = $request->input('hashtag');
|
||||
|
||||
if(config('database.default') === 'pgsql') {
|
||||
$hashtag = Hashtag::where('name', 'ilike', $tag)->firstOrFail();
|
||||
} else {
|
||||
$hashtag = Hashtag::whereName($tag)->firstOrFail();
|
||||
}
|
||||
|
||||
if($hashtag->is_banned == true) {
|
||||
return [];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue