mirror of
https://github.com/zulip/zulip.git
synced 2025-10-28 18:43:52 +00:00
ruff: Fix SIM102 nested if statements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
50cf9bc4b8
commit
b0e569f07c
@@ -95,22 +95,23 @@ def filter_by_subscription_history(
|
||||
stream_messages = stream_messages[i:]
|
||||
break
|
||||
final_msg_count = len(stream_messages)
|
||||
if initial_msg_count == final_msg_count:
|
||||
if stream_messages[-1]["id"] <= event_last_message_id:
|
||||
stream_messages = []
|
||||
if (
|
||||
initial_msg_count == final_msg_count
|
||||
and stream_messages[-1]["id"] <= event_last_message_id
|
||||
):
|
||||
stream_messages = []
|
||||
else:
|
||||
raise AssertionError(f"{log_entry.event_type} is not a subscription event.")
|
||||
|
||||
if len(stream_messages) > 0:
|
||||
# We do this check for last event since if the last subscription
|
||||
# event was a subscription_deactivated then we don't want to create
|
||||
# UserMessage rows for any of the remaining messages.
|
||||
if stream_subscription_logs[-1].event_type in (
|
||||
RealmAuditLog.SUBSCRIPTION_ACTIVATED,
|
||||
RealmAuditLog.SUBSCRIPTION_CREATED,
|
||||
):
|
||||
for stream_message in stream_messages:
|
||||
store_user_message_to_insert(stream_message)
|
||||
# We do this check for last event since if the last subscription
|
||||
# event was a subscription_deactivated then we don't want to create
|
||||
# UserMessage rows for any of the remaining messages.
|
||||
if len(stream_messages) > 0 and stream_subscription_logs[-1].event_type in (
|
||||
RealmAuditLog.SUBSCRIPTION_ACTIVATED,
|
||||
RealmAuditLog.SUBSCRIPTION_CREATED,
|
||||
):
|
||||
for stream_message in stream_messages:
|
||||
store_user_message_to_insert(stream_message)
|
||||
return user_messages_to_insert
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user