Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location select widget - filter by whether the location "has users" #34912

Merged
merged 10 commits into from
Aug 2, 2024
7 changes: 3 additions & 4 deletions corehq/apps/locations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,8 @@ class LocationOptionsController(EmwfOptionsController):
namespace_locations = False
case_sharing_only = False

def __init__(self, *args):
args = list(args)
self.include_locations_with_no_users_allowed = args.pop(3)
def __init__(self, *args, include_locations_with_no_users_allowed=True):
self.include_locations_with_no_users_allowed = include_locations_with_no_users_allowed
super().__init__(*args)

@property
Expand All @@ -281,7 +280,7 @@ class LocationsSearchView(EmwfOptionsView):
@memoized
def options_controller(self):
return LocationOptionsController(self.request, self.domain, self.search,
self.include_locations_with_no_users_allowed)
include_locations_with_no_users_allowed=self.include_locations_with_no_users_allowed)


@method_decorator(use_bootstrap5, name='dispatch')
Expand Down
2 changes: 1 addition & 1 deletion corehq/messaging/scheduling/async_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def schedule_user_organization_recipients_response(self):
def _get_user_organization_response(self, case_sharing_only=False):
from corehq.apps.locations.views import LocationOptionsController
controller = LocationOptionsController(self.request, self.request.domain,
self.data.get('searchString'), False,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

self.data.get('searchString'),
case_sharing_only=case_sharing_only)
(count, results) = controller.get_options()
return results[:10]
Expand Down
Loading