fetch_initial_state_data: Pass realm as independent parameter.

This removes dependency of the function on user_profile to get the
realm, which will be useful when user_profile is None in case of web
public guests.
This commit is contained in:
Aman Agrawal
2020-09-22 16:19:39 +05:30
committed by Tim Abbott
parent 6e95809cc4
commit 48492a0633
3 changed files with 22 additions and 15 deletions

View File

@@ -86,10 +86,10 @@ def fetch_initial_state_data(user_profile: UserProfile,
event_types: Optional[Iterable[str]],
queue_id: str, client_gravatar: bool,
user_avatar_url_field_optional: bool,
realm: Realm,
slim_presence: bool = False,
include_subscribers: bool = True) -> Dict[str, Any]:
state: Dict[str, Any] = {'queue_id': queue_id}
realm = user_profile.realm
if event_types is None:
# return True always
@@ -882,6 +882,7 @@ def do_events_register(user_profile: UserProfile, user_client: Client,
ret = fetch_initial_state_data(user_profile, event_types_set, 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)