Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

minor: Clean up args for apply_event.

Steve Howell3fa595ef8563
diff --git a/docs/tutorials/new-feature-tutorial.md b/docs/tutorials/new-feature-tutorial.md
index 89906805ed1..57df70d2d77 100644
--- a/docs/tutorials/new-feature-tutorial.md
+++ b/docs/tutorials/new-feature-tutorial.md
@@ -359,7 +359,10 @@ race conditions.
state['realm_allow_message_editing'] = user_profile.realm.allow_message_editing
# ...
- def apply_event(state, events, user_profile, include_subscribers):
+ def apply_event
+ user_profile: UserProfile,
+ # ...
+ ) -> None:
for event in events:
# ...
elif event['type'] == 'realm':
diff --git a/zerver/lib/events.py b/zerver/lib/events.py
index d894b66ba0b..4724bd3fce8 100644
--- a/zerver/lib/events.py
+++ b/zerver/lib/events.py
@@ -438,15 +438,24 @@ def apply_events(
# `apply_event`. For now, be careful in your choice of
# `fetch_event_types`.
continue
- apply_event(state, event, user_profile,
- client_gravatar, slim_presence, include_subscribers)
-
-def apply_event(state: Dict[str, Any],
- event: Dict[str, Any],
- user_profile: UserProfile,
- client_gravatar: bool,
- slim_presence: bool,
- include_subscribers: bool) -> None:
+ apply_event(
+ user_profile,
+ state=state,
+ event=event,
+ client_gravatar=client_gravatar,
+ slim_presence=slim_presence,
+ include_subscribers=include_subscribers,
+ )
+
+def apply_event(
+ user_profile: UserProfile,
+ *,
+ state: Dict[str, Any],
+ event: Dict[str, Any],
+ client_gravatar: bool,
+ slim_presence: bool,
+ include_subscribers: bool,
+) -> None:
if event['type'] == "message":
state['max_message_id'] = max(state['max_message_id'], event['message']['id'])
if 'raw_unread_msgs' in state: