direct_messages: Use DM groups for 1:1 or self DMs if present.

This is a preparatory refactor for migrating the internal structure of
Recipient objects for group DMs to use the DirectMessageGroup type,
not the legacy PERSONAL type. This step has the message-sending code
path check if a DirectMessageGroupe exists and prefer it if available.

It should have no effect in production other than doing a useless
database query for each outgoing DM, since we do not at present ever
create such DirectMessageGroup objects. (It will not add a marginal
database query once the migration is complete, just during this
transition).
This commit is contained in:
Mohammad Reza Kianifar
2025-05-15 03:02:11 +00:00
committed by Tim Abbott
parent e5db9614eb
commit a0488715f3
10 changed files with 151 additions and 28 deletions

View File

@@ -1032,7 +1032,7 @@ class LoginTest(ZulipTestCase):
# to sending messages, such as getting the welcome bot, looking up
# the alert words for a realm, etc.
with (
self.assert_database_query_count(96),
self.assert_database_query_count(97),
self.assert_memcached_count(18),
self.captureOnCommitCallbacks(execute=True),
):