mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
bulk_create: Fix buggy logic for generating recipients_by_email.
This buggy logic from e1686f427c had
broken do-destroy-rebuild-test-database.
Now that we're not just trying to add the Recipient objects for every
user on the system here to profiles_by_id, we also shouldn't be
processing every Recipeint object on the system. The fix is simple:
because of the patch we got merged into Django upstream,
recipients_to_create actually has the object IDs added to the
Recipient objects passed into Recipient.objects.bulk_create.
This was missed in manual testing, since it only broke `populate_db
--test-suite`.
This commit is contained in:
@@ -48,7 +48,7 @@ def bulk_create_users(realm: Realm,
|
||||
Recipient.objects.bulk_create(recipients_to_create)
|
||||
|
||||
recipients_by_email = {} # type: Dict[Text, Recipient]
|
||||
for recipient in Recipient.objects.filter(type=Recipient.PERSONAL):
|
||||
for recipient in recipients_to_create:
|
||||
recipients_by_email[profiles_by_id[recipient.type_id].email] = recipient
|
||||
|
||||
subscriptions_to_create = [] # type: List[Subscription]
|
||||
|
||||
Reference in New Issue
Block a user