diff --git a/corehq/apps/locations/forms.py b/corehq/apps/locations/forms.py index f4e9b4d00b6e..2cc4466a6c5a 100644 --- a/corehq/apps/locations/forms.py +++ b/corehq/apps/locations/forms.py @@ -14,7 +14,6 @@ from dimagi.utils.couch.database import iter_docs from corehq import toggles -from corehq.feature_previews import USE_LOCATION_DISPLAY_NAME from corehq.apps.custom_data_fields.edit_entity import ( CUSTOM_DATA_FIELD_PREFIX, CustomDataEditor, @@ -33,7 +32,6 @@ from corehq.apps.users.models import CommCareUser from corehq.apps.users.util import user_display_string from corehq.util.quickcache import quickcache -from corehq.util.global_request import get_request_domain from .models import ( LocationFixtureConfiguration, @@ -63,11 +61,10 @@ def render(self, name, value, attrs=None, renderer=None): location_ids = to_list(value) if value else [] locations = list(SQLLocation.active_objects .filter(domain=self.domain, location_id__in=location_ids)) - use_location_display_name = USE_LOCATION_DISPLAY_NAME.enabled(get_request_domain()) + initial_data = [{ 'id': loc.location_id, - 'text': loc.display_name if use_location_display_name else loc.get_path_display(), - 'tooltip': loc.get_path_display() if use_location_display_name else loc.display_name, + 'text': loc.get_path_display(), } for loc in locations] return get_template(self.template).render({ diff --git a/corehq/apps/locations/static/locations/js/widgets.js b/corehq/apps/locations/static/locations/js/widgets.js index 7a9ada10f4ce..895351cb7fee 100644 --- a/corehq/apps/locations/static/locations/js/widgets.js +++ b/corehq/apps/locations/static/locations/js/widgets.js @@ -14,9 +14,7 @@ hqDefine("locations/js/widgets", [ _.each($source.select2('data'), function (result) { const fullLengthName = result.text || result.name; const truncatedName = truncateLocationName(fullLengthName, $select); - var $option = new Option(truncatedName, result.id); - $option.setAttribute('title', result.tooltip || result.title); - $select.append($option); + $select.append(new Option(truncatedName, result.id)); }); } @@ -98,9 +96,7 @@ hqDefine("locations/js/widgets", [ }, }, templateResult: function (result) { - var $option = new Option(result.text); - $option.setAttribute('title', result.tooltip); - return $option; + return result.text || result.name; }, templateSelection: function (result) { const fullLengthName = result.text || result.name; @@ -115,9 +111,7 @@ hqDefine("locations/js/widgets", [ initial = [initial]; } _.each(initial, function (result) { - var $option = new Option(result.text, result.id); - $option.setAttribute('title', result.tooltip); - $select.append($option); + $select.append(new Option(result.text, result.id)); }); $select.val(_.pluck(initial, 'id')).trigger('change'); } @@ -144,9 +138,7 @@ hqDefine("locations/js/widgets", [ // This custom event is fired in autocomplete_select_widget.html if ($source.hasClass("select2-hidden-accessible")) { updateSelect2($source, $select); - var $option = new Option(value.text, value.id); - $option.setAttribute('title', value.tooltip); - $select.append($option); + $select.append(new Option(value.text, value.id)); $select.val(value.id).trigger("change"); } else { $source.on('select-ready', function () { diff --git a/corehq/apps/reports/filters/controllers.py b/corehq/apps/reports/filters/controllers.py index c58d56bc04a5..3596d4d713f9 100644 --- a/corehq/apps/reports/filters/controllers.py +++ b/corehq/apps/reports/filters/controllers.py @@ -199,8 +199,7 @@ def get_options(self, show_more=False): ) results = [ {'id': entry[0], 'text': entry[1]} if len(entry) == 2 else - {'id': entry[0], 'text': entry[1], 'is_active': entry[2]} if len(entry) == 3 else - {'id': entry[0], 'text': entry[1], 'is_active': entry[2], 'tooltip': entry[3]} for entry + {'id': entry[0], 'text': entry[1], 'is_active': entry[2]} for entry in options ] diff --git a/corehq/apps/reports/filters/users.py b/corehq/apps/reports/filters/users.py index f41dc2fe43d0..179881308ac8 100644 --- a/corehq/apps/reports/filters/users.py +++ b/corehq/apps/reports/filters/users.py @@ -7,7 +7,6 @@ from memoized import memoized from corehq import toggles -from corehq.feature_previews import USE_LOCATION_DISPLAY_NAME from corehq.apps.domain.models import Domain from corehq.apps.enterprise.models import EnterprisePermissions from corehq.apps.es import filters @@ -21,7 +20,6 @@ from corehq.apps.users.models import CommCareUser, UserHistory, WebUser from corehq.apps.users.util import cached_user_id_to_user_display from corehq.const import USER_DATETIME_FORMAT -from corehq.util.global_request import get_request_domain from corehq.util.timezones.conversions import ServerTime from corehq.util.timezones.utils import get_timezone_for_user @@ -140,13 +138,11 @@ def user_type_tuple(self, t): def location_tuple(self, location): location_id = location.location_id - use_location_display_name = USE_LOCATION_DISPLAY_NAME.enabled(get_request_domain()) - text = location.display_name if use_location_display_name else location.get_path_display() - tooltip = location.get_path_display() if use_location_display_name else location.display_name + text = location.get_path_display() if self.namespace_locations: location_id = f'l__{location_id}' text = f'{text} [location]' - return (location_id, text, None, tooltip) + return (location_id, text) @property @memoized diff --git a/corehq/apps/users/forms.py b/corehq/apps/users/forms.py index d476fc39f4ae..bc9bf6e710e5 100644 --- a/corehq/apps/users/forms.py +++ b/corehq/apps/users/forms.py @@ -57,13 +57,11 @@ from corehq.apps.user_importer.helpers import UserChangeLogger from corehq.const import LOADTEST_HARD_LIMIT, USER_CHANGE_VIA_WEB from corehq.pillows.utils import MOBILE_USER_TYPE, WEB_USER_TYPE -from corehq.feature_previews import USE_LOCATION_DISPLAY_NAME from corehq.toggles import ( LOCATION_HAS_USERS, TWO_STAGE_USER_PROVISIONING, TWO_STAGE_USER_PROVISIONING_BY_SMS, ) -from corehq.util.global_request import get_request_domain from ..hqwebapp.signals import clear_login_attempts from .audit.change_messages import UserChangeMessage @@ -1127,11 +1125,9 @@ def render(self, name, value, attrs=None, renderer=None): if value: try: loc = SQLLocation.objects.get(location_id=value) - use_location_display_name = USE_LOCATION_DISPLAY_NAME.enabled(get_request_domain()) initial_data = { 'id': loc.location_id, - 'text': loc.display_name if use_location_display_name else loc.get_path_display(), - 'tooltip': loc.get_path_display() if use_location_display_name else loc.display_name, + 'text': loc.get_path_display(), } except SQLLocation.DoesNotExist: pass diff --git a/corehq/feature_previews.py b/corehq/feature_previews.py index 364a93b05ccc..69ad8bbbb761 100644 --- a/corehq/feature_previews.py +++ b/corehq/feature_previews.py @@ -134,15 +134,6 @@ def previews_enabled_for_domain(domain): ) ) -USE_LOCATION_DISPLAY_NAME = FeaturePreview( - slug='use_location_display_name', - label=_('Use location name'), - description=_( - "This setting changes the location dropdown to display location name instead of " - "the full location path." - ) -) - def enable_callcenter(domain_name, checked): from corehq.apps.domain.models import Domain