Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
register: Refactor to pass client_capabilities directly.
Aman Agrawal21ac1fb32c35
diff --git a/zerver/lib/events.py b/zerver/lib/events.pyindex 018b18f55d8..17642e1e0d6 100644--- a/zerver/lib/events.py+++ b/zerver/lib/events.py@@ -830,7 +830,7 @@ def do_events_register(user_profile: UserProfile, user_client: Client,queue_lifespan_secs: int = 0,all_public_streams: bool = False,include_subscribers: bool = True,- notification_settings_null: bool = False,+ client_capabilities: Dict[str, bool] = {},narrow: Iterable[Sequence[str]] = [],fetch_event_types: Optional[Iterable[str]] = None) -> Dict[str, Any]:# Technically we don't need to check this here because@@ -838,6 +838,8 @@ def do_events_register(user_profile: UserProfile, user_client: Client,# handling perspective to do it before contacting Tornadocheck_supported_events_narrow_filter(narrow)+ notification_settings_null = client_capabilities.get('notification_settings_null', False)+if user_profile.realm.email_address_visibility != Realm.EMAIL_ADDRESS_VISIBILITY_EVERYONE:# If real email addresses are not available to the user, their# clients cannot compute gravatars, so we force-set it to false.diff --git a/zerver/views/events_register.py b/zerver/views/events_register.pyindex 32b32778772..cba94e6e9c2 100644--- a/zerver/views/events_register.py+++ b/zerver/views/events_register.py@@ -50,12 +50,11 @@ def events_register_backend(if client_capabilities is None:client_capabilities = {}- notification_settings_null = client_capabilities.get("notification_settings_null", False)ret = do_events_register(user_profile, request.client,apply_markdown, client_gravatar, slim_presence,event_types, queue_lifespan_secs, all_public_streams,narrow=narrow, include_subscribers=include_subscribers,- notification_settings_null=notification_settings_null,+ client_capabilities=client_capabilities,fetch_event_types=fetch_event_types)return json_success(ret)diff --git a/zerver/views/home.py b/zerver/views/home.pyindex ff1c47f522d..a4765165c54 100644--- a/zerver/views/home.py+++ b/zerver/views/home.py@@ -189,10 +189,14 @@ def home_real(request: HttpRequest) -> HttpResponse:narrow, narrow_stream, narrow_topic = detect_narrowed_window(request, user_profile)+ client_capabilities = {+ 'notification_settings_null': True,+ }+register_ret = do_events_register(user_profile, request.client,apply_markdown=True, client_gravatar=True,slim_presence=True,- notification_settings_null=True,+ client_capabilities=client_capabilities,narrow=narrow)update_last_reminder(user_profile)