refactor: Rename huddle to direct_message_group in non api files.

This commit completes rename of "huddle" to "direct_message_group"
in all the non API files.

Part of #28640
This commit is contained in:
roanster007
2024-07-08 20:16:01 +05:30
committed by Tim Abbott
parent 4b04e2c09c
commit 7b3e163d55
15 changed files with 210 additions and 175 deletions

View File

@@ -150,7 +150,7 @@ class Message(AbstractMessage):
# A detail worth noting:
# * "direct" was introduced in 2023 with the goal of
# deprecating the original "private" and becoming the
# preferred way to indicate a personal or huddle
# preferred way to indicate a personal or direct_message_group
# Recipient type via the API.
API_RECIPIENT_TYPES = ["direct", "private", "stream", "channel"]

View File

@@ -43,7 +43,7 @@ class Recipient(models.Model):
id = models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")
type_id = models.IntegerField(db_index=True)
type = models.PositiveSmallIntegerField(db_index=True)
# Valid types are {personal, stream, huddle}
# Valid types are {personal, stream, direct_message_group}
# The type for 1:1 direct messages.
PERSONAL = 1
@@ -56,7 +56,11 @@ class Recipient(models.Model):
unique_together = ("type", "type_id")
# N.B. If we used Django's choice=... we would get this for free (kinda)
_type_names = {PERSONAL: "personal", STREAM: "stream", DIRECT_MESSAGE_GROUP: "huddle"}
_type_names = {
PERSONAL: "personal",
STREAM: "stream",
DIRECT_MESSAGE_GROUP: "direct_message_group",
}
@override
def __str__(self) -> str:
@@ -91,12 +95,13 @@ def get_direct_message_group_user_ids(recipient: Recipient) -> ValuesQuerySet["S
def bulk_get_direct_message_group_user_ids(recipient_ids: list[int]) -> dict[int, set[int]]:
"""
Takes a list of huddle-type recipient_ids, returns a dict
mapping recipient id to list of user ids in the huddle.
Takes a list of direct_message_group type recipient_ids, returns
a dictmapping recipient id to list of user ids in the direct
message group.
We rely on our caller to pass us recipient_ids that correspond
to huddles, but technically this function is valid for any type
of subscription.
to direct_message_group, but technically this function is valid
for any typeof subscription.
"""
from zerver.models import Subscription

View File

@@ -72,7 +72,7 @@ class MissedMessageEmailAddress(models.Model):
class NotificationTriggers:
# "direct_message" is for 1:1 direct messages as well as huddles
# "direct_message" is for 1:1 and group direct messages
DIRECT_MESSAGE = "direct_message"
MENTION = "mentioned"
TOPIC_WILDCARD_MENTION = "topic_wildcard_mentioned"