mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
refactor: Clean up args for fetch_initial_state_data.
We now require explicit keywords for all arguments to fetch_initial_state_data except user_profile. We provide reasonable defaults to keep the test code concise.
This commit is contained in:
committed by
Steve Howell
parent
08d716c741
commit
3df507be73
@@ -83,11 +83,12 @@ def always_want(msg_type: str) -> bool:
|
||||
|
||||
def fetch_initial_state_data(
|
||||
user_profile: Optional[UserProfile],
|
||||
event_types: Optional[Iterable[str]],
|
||||
queue_id: Optional[str],
|
||||
client_gravatar: bool,
|
||||
user_avatar_url_field_optional: bool,
|
||||
realm: Realm,
|
||||
*,
|
||||
realm: Optional[Realm] = None,
|
||||
event_types: Optional[Iterable[str]] = None,
|
||||
queue_id: Optional[str] = "",
|
||||
client_gravatar: bool = False,
|
||||
user_avatar_url_field_optional: bool = False,
|
||||
slim_presence: bool = False,
|
||||
include_subscribers: bool = True,
|
||||
include_streams: bool = True,
|
||||
@@ -103,6 +104,10 @@ def fetch_initial_state_data(
|
||||
corresponding events for changes in the data structures and new
|
||||
code to apply_events (and add a test in test_events.py).
|
||||
"""
|
||||
if realm is None:
|
||||
assert user_profile is not None
|
||||
realm = user_profile.realm
|
||||
|
||||
state: Dict[str, Any] = {'queue_id': queue_id}
|
||||
|
||||
if event_types is None:
|
||||
@@ -965,11 +970,10 @@ def do_events_register(
|
||||
|
||||
ret = fetch_initial_state_data(
|
||||
user_profile,
|
||||
event_types_set,
|
||||
queue_id,
|
||||
event_types=event_types_set,
|
||||
queue_id=queue_id,
|
||||
client_gravatar=client_gravatar,
|
||||
user_avatar_url_field_optional=user_avatar_url_field_optional,
|
||||
realm=user_profile.realm,
|
||||
slim_presence=slim_presence,
|
||||
include_subscribers=include_subscribers,
|
||||
include_streams=include_streams,
|
||||
|
||||
Reference in New Issue
Block a user