Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
populate_db: Select DM group for 1:1 DMs based on settings.
Mohammad Reza Kianifarf5c20e59e1a8
diff --git a/zilencer/management/commands/populate_db.py b/zilencer/management/commands/populate_db.pyindex fc5b2f7d12a..9f62ecbcc22 100644--- a/zilencer/management/commands/populate_db.py+++ b/zilencer/management/commands/populate_db.py@@ -1360,9 +1360,14 @@ def generate_and_send_messages(message.sender = get_user_profile_by_id(sender_id)message.subject = Message.DM_TOPICelif recipient_type == Recipient.PERSONAL:- message.recipient = Recipient.objects.get(- type=Recipient.PERSONAL, type_id=personals_pair[0]- )+ if settings.PREFER_DIRECT_MESSAGE_GROUP:+ direct_message_group = get_or_create_direct_message_group(personals_pair)+ assert direct_message_group.recipient is not None+ message.recipient = direct_message_group.recipient+ else:+ message.recipient = Recipient.objects.get(+ type=Recipient.PERSONAL, type_id=personals_pair[0]+ )message.sender = get_user_profile_by_id(personals_pair[1])message.subject = Message.DM_TOPICsaved_data["personals_pair"] = personals_pair