actions: Fix incorrect audit logging in bulk_remove_subscriptions.

modified_user=sub_info.user and modified_stream=sub_info.stream, added
by commit 6d1f9de7d3 (#16553), were
always coming from the last entry in the loop above, not from the
enclosing list comprehension.

Found by the Pylint rule undefined-loop-variable.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-05-24 18:25:56 -07:00 committed by Tim Abbott
parent 05b7d4ba13
commit 0ce015348e
1 changed files with 2 additions and 2 deletions

View File

@ -3921,7 +3921,7 @@ def bulk_remove_subscriptions(
event_last_message_id = get_last_message_id()
all_subscription_logs = [
RealmAuditLog(
realm=sub.user.realm,
realm=sub_info.user.realm,
acting_user=acting_user,
modified_user=sub_info.user,
modified_stream=sub_info.stream,
@ -3929,7 +3929,7 @@ def bulk_remove_subscriptions(
event_type=RealmAuditLog.SUBSCRIPTION_DEACTIVATED,
event_time=event_time,
)
for sub in subs_to_deactivate
for sub_info in subs_to_deactivate
]
# Now since we have all log objects generated we can do a bulk insert