Explorar o código

use case insensitive search when tagging accounts

Mackenzie Morgan hai 2 meses
pai
achega
9966260a91
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      app/Http/Controllers/ComposeController.php

+ 2 - 1
app/Http/Controllers/ComposeController.php

@@ -268,10 +268,11 @@ class ComposeController extends Controller
 
         $blocked->push($request->user()->profile_id);
 
+        $operator = config('database.default') === 'pgsql' ? 'ilike' : 'like';
         $results = Profile::select('id', 'domain', 'username')
             ->whereNotIn('id', $blocked)
             ->whereNull('domain')
-            ->where('username', 'like', '%'.$q.'%')
+            ->where('username', $operator, '%'.$q.'%')
             ->limit(15)
             ->get()
             ->map(function ($r) {