From f67fada2739f36d0231ce77838712624ae6eebfa Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 28 Apr 2020 02:42:21 -0600 Subject: [PATCH 1/2] Update SearchController, fix self search bug and rank local matches first --- app/Http/Controllers/SearchController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index 332b679fb..3555bfe94 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -194,11 +194,14 @@ class SearchController extends Controller else { $this->tokens['profiles'] = Cache::remember($key, $ttl, function() use($tag) { - $users = Profile::select('domain', 'username', 'name', 'id') + if(Str::startsWith($tag, '@')) { + $tag = substr($tag, 1); + } + $users = Profile::select('status', 'domain', 'username', 'name', 'id') ->whereNull('status') - ->where('id', '!=', Auth::user()->profile->id) ->where('username', 'like', '%'.$tag.'%') ->limit(20) + ->orderBy('domain') ->get(); if($users->count() > 0) { From ed5667c8ffdc6ed9a96210a0fe3ff9e1c1ee525a Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 28 Apr 2020 02:43:43 -0600 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 547543e97..75c857a42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - Updated NotificationCard.vue component, add follow requests at top of card, remove card-header ([5e48ffca](https://github.com/pixelfed/pixelfed/commit/5e48ffca)) - Updated RemoteProfile.vue component, add warning for empty profiles and last_fetched_at ([66f44a9d](https://github.com/pixelfed/pixelfed/commit/66f44a9d)) - Updated ApiV1Controller, enforce public timeline setting ([285bd485](https://github.com/pixelfed/pixelfed/commit/285bd485)) +- Update SearchController, fix self search bug and rank local matches higher ([f67fada2](https://github.com/pixelfed/pixelfed/commit/f67fada2)) ## [v0.10.9 (2020-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.10.8...v0.10.9)