diff --git a/zerver/lib/soft_deactivation.py b/zerver/lib/soft_deactivation.py index f6628ba153..dfd9be2dd8 100644 --- a/zerver/lib/soft_deactivation.py +++ b/zerver/lib/soft_deactivation.py @@ -176,8 +176,7 @@ def add_missing_messages(user_profile: UserProfile) -> None: # meantime. Without that tiebreak, we could end up incorrectly # processing the ordering of those two subscription changes. subscription_logs = list( - RealmAuditLog.objects.select_related("modified_stream") - .filter( + RealmAuditLog.objects.filter( modified_user=user_profile, modified_stream_id__in=stream_ids, event_type__in=events ) .order_by("event_last_message_id", "id")