mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 08:13:16 +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'
|
'limit' => 'nullable|integer|max:100'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tag = Hashtag::whereName($hashtag)
|
if(config('database.default') === 'pgsql') {
|
||||||
->orWhere('slug', $hashtag)
|
$tag = Hashtag::where('name', 'ilike', $hashtag)
|
||||||
->first();
|
->orWhere('slug', 'ilike', $hashtag)
|
||||||
|
->first();
|
||||||
|
} else {
|
||||||
|
$tag = Hashtag::whereName($hashtag)
|
||||||
|
->orWhere('slug', $hashtag)
|
||||||
|
->first();
|
||||||
|
}
|
||||||
|
|
||||||
if(!$tag) {
|
if(!$tag) {
|
||||||
return response()->json([]);
|
return response()->json([]);
|
||||||
|
|
|
@ -61,7 +61,12 @@ class DiscoverController extends Controller
|
||||||
$end = $page > 1 ? $page * 9 : 0;
|
$end = $page > 1 ? $page * 9 : 0;
|
||||||
$tag = $request->input('hashtag');
|
$tag = $request->input('hashtag');
|
||||||
|
|
||||||
$hashtag = Hashtag::whereName($tag)->firstOrFail();
|
if(config('database.default') === 'pgsql') {
|
||||||
|
$hashtag = Hashtag::where('name', 'ilike', $tag)->firstOrFail();
|
||||||
|
} else {
|
||||||
|
$hashtag = Hashtag::whereName($tag)->firstOrFail();
|
||||||
|
}
|
||||||
|
|
||||||
if($hashtag->is_banned == true) {
|
if($hashtag->is_banned == true) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue