From c8e5b5a8afe895abcf9e67e45241dc94105c73e1 Mon Sep 17 00:00:00 2001 From: Edward Hibbert Date: Wed, 8 Sep 2021 17:40:17 +0100 Subject: [PATCH 1/5] More work on nearby groups. --- app/Http/Controllers/GroupController.php | 7 ++-- resources/js/components/GroupsPage.vue | 9 +++++ resources/js/components/GroupsTable.vue | 9 ++++- resources/lang/en/groups.php | 4 ++- .../partials/tables/head-groups.blade.php | 24 ------------- .../partials/tables/row-groups.blade.php | 36 ------------------- 6 files changed, 23 insertions(+), 66 deletions(-) delete mode 100644 resources/views/partials/tables/head-groups.blade.php delete mode 100644 resources/views/partials/tables/row-groups.blade.php diff --git a/app/Http/Controllers/GroupController.php b/app/Http/Controllers/GroupController.php index 0169547e2a..5717ecd64f 100644 --- a/app/Http/Controllers/GroupController.php +++ b/app/Http/Controllers/GroupController.php @@ -62,13 +62,11 @@ private function indexVariations($tab, $network) ->select($group_atts) ->get(); - //Make sure we don't show the same groups in nearest to you - $your_groups_uniques = $your_groups->pluck('idgroups')->toArray(); - $groups_near_you = $user->groupsNearby(10); + // We pass a high limit to the groups nearby; there is a distance limit which will normally kick in first. + $groups_near_you = $user->groupsNearby(1000); return view('group.index', [ 'your_groups' => $this->expandGroups($your_groups), - 'your_groups_uniques' => $your_groups_uniques, 'groups_near_you' => $this->expandGroups($groups_near_you), 'groups' => $this->expandGroups($groups), 'your_area' => $user->location, @@ -830,6 +828,7 @@ private function expandGroups($groups) 'networks' => Arr::pluck($group->networks, 'id'), 'country' => $group->country, 'group_tags' => $group->group_tags()->get()->pluck('id'), + 'distance' => $group->distance ]; } } diff --git a/resources/js/components/GroupsPage.vue b/resources/js/components/GroupsPage.vue index f97ed5314f..6f3f2a1314 100644 --- a/resources/js/components/GroupsPage.vue +++ b/resources/js/components/GroupsPage.vue @@ -43,6 +43,10 @@ {{ __('groups.groups_title2') }}
+

+ {{ nearestGroups }} + {{ __('groups.nearest_groups_change') }}. +

-

+

{{ nearestGroups }} {{ __('groups.nearest_groups_change') }}.