mirror of https://github.com/zulip/zulip.git
refactor: Replace HUDDLE with DIRECT_MESSAGE_GROUP.
Replaced HUDDLE attribute with DIRECT_MESSAGE_GROUP using VS Code search, part of a general renaming of the object class. Fixes part of #28640. Co-authored-by: JohnLu2004 <JohnLu10212004@gmail.com>
This commit is contained in:
parent
224b484195
commit
a5cf0ec526
|
@ -170,7 +170,7 @@ class AnalyticsTestCase(ZulipTestCase):
|
||||||
for key, value in defaults.items():
|
for key, value in defaults.items():
|
||||||
kwargs[key] = kwargs.get(key, value)
|
kwargs[key] = kwargs.get(key, value)
|
||||||
huddle = Huddle.objects.create(**kwargs)
|
huddle = Huddle.objects.create(**kwargs)
|
||||||
recipient = Recipient.objects.create(type_id=huddle.id, type=Recipient.HUDDLE)
|
recipient = Recipient.objects.create(type_id=huddle.id, type=Recipient.DIRECT_MESSAGE_GROUP)
|
||||||
huddle.recipient = recipient
|
huddle.recipient = recipient
|
||||||
huddle.save(update_fields=["recipient"])
|
huddle.save(update_fields=["recipient"])
|
||||||
return huddle, recipient
|
return huddle, recipient
|
||||||
|
|
|
@ -372,7 +372,7 @@ def get_recipient_info(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
elif recipient.type == Recipient.HUDDLE:
|
elif recipient.type == Recipient.DIRECT_MESSAGE_GROUP:
|
||||||
message_to_user_ids = get_huddle_user_ids(recipient)
|
message_to_user_ids = get_huddle_user_ids(recipient)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -738,7 +738,7 @@ def create_user_messages(
|
||||||
base_flags = 0
|
base_flags = 0
|
||||||
if rendering_result.mentions_stream_wildcard:
|
if rendering_result.mentions_stream_wildcard:
|
||||||
base_flags |= UserMessage.flags.stream_wildcard_mentioned
|
base_flags |= UserMessage.flags.stream_wildcard_mentioned
|
||||||
if message.recipient.type in [Recipient.HUDDLE, Recipient.PERSONAL]:
|
if message.recipient.type in [Recipient.DIRECT_MESSAGE_GROUP, Recipient.PERSONAL]:
|
||||||
base_flags |= UserMessage.flags.is_private
|
base_flags |= UserMessage.flags.is_private
|
||||||
|
|
||||||
# For long_term_idle (aka soft-deactivated) users, we are allowed
|
# For long_term_idle (aka soft-deactivated) users, we are allowed
|
||||||
|
@ -1222,7 +1222,7 @@ def do_send_messages(
|
||||||
|
|
||||||
|
|
||||||
def already_sent_mirrored_message_id(message: Message) -> Optional[int]:
|
def already_sent_mirrored_message_id(message: Message) -> Optional[int]:
|
||||||
if message.recipient.type == Recipient.HUDDLE:
|
if message.recipient.type == Recipient.DIRECT_MESSAGE_GROUP:
|
||||||
# For huddle messages, we use a 10-second window because the
|
# For huddle messages, we use a 10-second window because the
|
||||||
# timestamps aren't guaranteed to actually match between two
|
# timestamps aren't guaranteed to actually match between two
|
||||||
# copies of the same message.
|
# copies of the same message.
|
||||||
|
|
|
@ -589,7 +589,7 @@ def do_scrub_realm(realm: Realm, *, acting_user: Optional[UserProfile]) -> None:
|
||||||
*Stream.objects.filter(realm=realm).values_list("recipient_id", flat=True),
|
*Stream.objects.filter(realm=realm).values_list("recipient_id", flat=True),
|
||||||
*UserProfile.objects.filter(realm=realm).values_list("recipient_id", flat=True),
|
*UserProfile.objects.filter(realm=realm).values_list("recipient_id", flat=True),
|
||||||
*Subscription.objects.filter(
|
*Subscription.objects.filter(
|
||||||
recipient__type=Recipient.HUDDLE, user_profile__realm=realm
|
recipient__type=Recipient.DIRECT_MESSAGE_GROUP, user_profile__realm=realm
|
||||||
).values_list("recipient_id", flat=True),
|
).values_list("recipient_id", flat=True),
|
||||||
]
|
]
|
||||||
cross_realm_bot_message_ids = list(
|
cross_realm_bot_message_ids = list(
|
||||||
|
|
|
@ -65,7 +65,7 @@ def do_delete_user(user_profile: UserProfile, *, acting_user: Optional[UserProfi
|
||||||
|
|
||||||
subscribed_huddle_recipient_ids = set(
|
subscribed_huddle_recipient_ids = set(
|
||||||
Subscription.objects.filter(
|
Subscription.objects.filter(
|
||||||
user_profile=user_profile, recipient__type=Recipient.HUDDLE
|
user_profile=user_profile, recipient__type=Recipient.DIRECT_MESSAGE_GROUP
|
||||||
).values_list("recipient_id", flat=True)
|
).values_list("recipient_id", flat=True)
|
||||||
)
|
)
|
||||||
user_id = user_profile.id
|
user_id = user_profile.id
|
||||||
|
@ -203,7 +203,7 @@ def do_delete_user_preserving_messages(user_profile: UserProfile) -> None:
|
||||||
sender=temp_replacement_user
|
sender=temp_replacement_user
|
||||||
)
|
)
|
||||||
Subscription.objects.filter(
|
Subscription.objects.filter(
|
||||||
user_profile=user_profile, recipient__type=Recipient.HUDDLE
|
user_profile=user_profile, recipient__type=Recipient.DIRECT_MESSAGE_GROUP
|
||||||
).update(user_profile=temp_replacement_user)
|
).update(user_profile=temp_replacement_user)
|
||||||
user_profile.delete()
|
user_profile.delete()
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ def do_delete_user_preserving_messages(user_profile: UserProfile) -> None:
|
||||||
sender=replacement_user
|
sender=replacement_user
|
||||||
)
|
)
|
||||||
Subscription.objects.filter(
|
Subscription.objects.filter(
|
||||||
user_profile=temp_replacement_user, recipient__type=Recipient.HUDDLE
|
user_profile=temp_replacement_user, recipient__type=Recipient.DIRECT_MESSAGE_GROUP
|
||||||
).update(user_profile=replacement_user, is_user_active=replacement_user.is_active)
|
).update(user_profile=replacement_user, is_user_active=replacement_user.is_active)
|
||||||
temp_replacement_user.delete()
|
temp_replacement_user.delete()
|
||||||
|
|
||||||
|
@ -276,12 +276,12 @@ def send_events_for_user_deactivation(user_profile: UserProfile) -> None:
|
||||||
# separately.
|
# separately.
|
||||||
deactivated_user_subs = Subscription.objects.filter(
|
deactivated_user_subs = Subscription.objects.filter(
|
||||||
user_profile=user_profile,
|
user_profile=user_profile,
|
||||||
recipient__type__in=[Recipient.STREAM, Recipient.HUDDLE],
|
recipient__type__in=[Recipient.STREAM, Recipient.DIRECT_MESSAGE_GROUP],
|
||||||
active=True,
|
active=True,
|
||||||
).values_list("recipient_id", flat=True)
|
).values_list("recipient_id", flat=True)
|
||||||
subscribers_in_deactivated_user_subs = Subscription.objects.filter(
|
subscribers_in_deactivated_user_subs = Subscription.objects.filter(
|
||||||
recipient_id__in=list(deactivated_user_subs),
|
recipient_id__in=list(deactivated_user_subs),
|
||||||
recipient__type__in=[Recipient.STREAM, Recipient.HUDDLE],
|
recipient__type__in=[Recipient.STREAM, Recipient.DIRECT_MESSAGE_GROUP],
|
||||||
is_user_active=True,
|
is_user_active=True,
|
||||||
active=True,
|
active=True,
|
||||||
).values_list("recipient__type", "user_profile_id")
|
).values_list("recipient__type", "user_profile_id")
|
||||||
|
@ -289,7 +289,7 @@ def send_events_for_user_deactivation(user_profile: UserProfile) -> None:
|
||||||
subscribers_in_deactivated_user_streams = set()
|
subscribers_in_deactivated_user_streams = set()
|
||||||
subscribers_in_deactivated_user_huddles = set()
|
subscribers_in_deactivated_user_huddles = set()
|
||||||
for recipient_type, user_id in subscribers_in_deactivated_user_subs:
|
for recipient_type, user_id in subscribers_in_deactivated_user_subs:
|
||||||
if recipient_type == Recipient.HUDDLE:
|
if recipient_type == Recipient.DIRECT_MESSAGE_GROUP:
|
||||||
subscribers_in_deactivated_user_huddles.add(user_id)
|
subscribers_in_deactivated_user_huddles.add(user_id)
|
||||||
else:
|
else:
|
||||||
subscribers_in_deactivated_user_streams.add(user_id)
|
subscribers_in_deactivated_user_streams.add(user_id)
|
||||||
|
|
|
@ -257,7 +257,8 @@ def build_huddle_subscriptions(
|
||||||
recipient_map = {
|
recipient_map = {
|
||||||
recipient["id"]: recipient["type_id"] # recipient_id -> stream_id
|
recipient["id"]: recipient["type_id"] # recipient_id -> stream_id
|
||||||
for recipient in zerver_recipient
|
for recipient in zerver_recipient
|
||||||
if recipient["type"] == Recipient.HUDDLE and recipient["type_id"] in huddle_ids
|
if recipient["type"] == Recipient.DIRECT_MESSAGE_GROUP
|
||||||
|
and recipient["type_id"] in huddle_ids
|
||||||
}
|
}
|
||||||
|
|
||||||
for recipient_id, huddle_id in recipient_map.items():
|
for recipient_id, huddle_id in recipient_map.items():
|
||||||
|
@ -340,7 +341,7 @@ def build_recipients(
|
||||||
|
|
||||||
for huddle in zerver_huddle:
|
for huddle in zerver_huddle:
|
||||||
type_id = huddle["id"]
|
type_id = huddle["id"]
|
||||||
type = Recipient.HUDDLE
|
type = Recipient.DIRECT_MESSAGE_GROUP
|
||||||
recipient = Recipient(
|
recipient = Recipient(
|
||||||
type_id=type_id,
|
type_id=type_id,
|
||||||
id=NEXT_ID("recipient"),
|
id=NEXT_ID("recipient"),
|
||||||
|
|
|
@ -459,7 +459,7 @@ def process_raw_message_batch(
|
||||||
)
|
)
|
||||||
elif "huddle_name" in raw_message:
|
elif "huddle_name" in raw_message:
|
||||||
recipient_id = get_recipient_id_from_receiver_name(
|
recipient_id = get_recipient_id_from_receiver_name(
|
||||||
raw_message["huddle_name"], Recipient.HUDDLE
|
raw_message["huddle_name"], Recipient.DIRECT_MESSAGE_GROUP
|
||||||
)
|
)
|
||||||
elif "pm_members" in raw_message:
|
elif "pm_members" in raw_message:
|
||||||
members = raw_message["pm_members"]
|
members = raw_message["pm_members"]
|
||||||
|
@ -673,7 +673,7 @@ def write_message_data(
|
||||||
for d in zerver_recipient:
|
for d in zerver_recipient:
|
||||||
if d["type"] == Recipient.STREAM:
|
if d["type"] == Recipient.STREAM:
|
||||||
stream_id_to_recipient_id[d["type_id"]] = d["id"]
|
stream_id_to_recipient_id[d["type_id"]] = d["id"]
|
||||||
elif d["type"] == Recipient.HUDDLE:
|
elif d["type"] == Recipient.DIRECT_MESSAGE_GROUP:
|
||||||
huddle_id_to_recipient_id[d["type_id"]] = d["id"]
|
huddle_id_to_recipient_id[d["type_id"]] = d["id"]
|
||||||
if d["type"] == Recipient.PERSONAL:
|
if d["type"] == Recipient.PERSONAL:
|
||||||
user_id_to_recipient_id[d["type_id"]] = d["id"]
|
user_id_to_recipient_id[d["type_id"]] = d["id"]
|
||||||
|
@ -682,7 +682,7 @@ def write_message_data(
|
||||||
if recipient_type == Recipient.STREAM:
|
if recipient_type == Recipient.STREAM:
|
||||||
receiver_id = stream_id_mapper.get(receiver_name)
|
receiver_id = stream_id_mapper.get(receiver_name)
|
||||||
recipient_id = stream_id_to_recipient_id[receiver_id]
|
recipient_id = stream_id_to_recipient_id[receiver_id]
|
||||||
elif recipient_type == Recipient.HUDDLE:
|
elif recipient_type == Recipient.DIRECT_MESSAGE_GROUP:
|
||||||
receiver_id = huddle_id_mapper.get(receiver_name)
|
receiver_id = huddle_id_mapper.get(receiver_name)
|
||||||
recipient_id = huddle_id_to_recipient_id[receiver_id]
|
recipient_id = huddle_id_to_recipient_id[receiver_id]
|
||||||
elif recipient_type == Recipient.PERSONAL:
|
elif recipient_type == Recipient.PERSONAL:
|
||||||
|
|
|
@ -880,7 +880,7 @@ def map_receiver_id_to_recipient_id(
|
||||||
for recipient in zerver_recipient:
|
for recipient in zerver_recipient:
|
||||||
if recipient["type"] == Recipient.STREAM:
|
if recipient["type"] == Recipient.STREAM:
|
||||||
stream_id_to_recipient_id[recipient["type_id"]] = recipient["id"]
|
stream_id_to_recipient_id[recipient["type_id"]] = recipient["id"]
|
||||||
elif recipient["type"] == Recipient.HUDDLE:
|
elif recipient["type"] == Recipient.DIRECT_MESSAGE_GROUP:
|
||||||
huddle_id_to_recipient_id[recipient["type_id"]] = recipient["id"]
|
huddle_id_to_recipient_id[recipient["type_id"]] = recipient["id"]
|
||||||
elif recipient["type"] == Recipient.PERSONAL:
|
elif recipient["type"] == Recipient.PERSONAL:
|
||||||
user_id_to_recipient_id[recipient["type_id"]] = recipient["id"]
|
user_id_to_recipient_id[recipient["type_id"]] = recipient["id"]
|
||||||
|
|
|
@ -611,7 +611,9 @@ def channels_to_zerver_stream(
|
||||||
|
|
||||||
added_mpims[mpim["name"]] = (mpim["id"], huddle_id_count)
|
added_mpims[mpim["name"]] = (mpim["id"], huddle_id_count)
|
||||||
|
|
||||||
recipient = build_recipient(huddle_id_count, recipient_id_count, Recipient.HUDDLE)
|
recipient = build_recipient(
|
||||||
|
huddle_id_count, recipient_id_count, Recipient.DIRECT_MESSAGE_GROUP
|
||||||
|
)
|
||||||
realm["zerver_recipient"].append(recipient)
|
realm["zerver_recipient"].append(recipient)
|
||||||
slack_recipient_name_to_zulip_recipient_id[mpim["name"]] = recipient_id_count
|
slack_recipient_name_to_zulip_recipient_id[mpim["name"]] = recipient_id_count
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,9 @@ def bulk_fetch_user_display_recipients(
|
||||||
get_type = lambda tup: tup[1]
|
get_type = lambda tup: tup[1]
|
||||||
|
|
||||||
personal_tuples = [tup for tup in recipient_tuples if get_type(tup) == Recipient.PERSONAL]
|
personal_tuples = [tup for tup in recipient_tuples if get_type(tup) == Recipient.PERSONAL]
|
||||||
huddle_tuples = [tup for tup in recipient_tuples if get_type(tup) == Recipient.HUDDLE]
|
huddle_tuples = [
|
||||||
|
tup for tup in recipient_tuples if get_type(tup) == Recipient.DIRECT_MESSAGE_GROUP
|
||||||
|
]
|
||||||
|
|
||||||
huddle_recipient_ids = [get_recipient_id(tup) for tup in huddle_tuples]
|
huddle_recipient_ids = [get_recipient_id(tup) for tup in huddle_tuples]
|
||||||
huddle_recipient_id_to_user_ids = bulk_get_huddle_user_ids(huddle_recipient_ids)
|
huddle_recipient_id_to_user_ids = bulk_get_huddle_user_ids(huddle_recipient_ids)
|
||||||
|
|
|
@ -450,7 +450,7 @@ def process_missed_message(to: str, message: EmailMessage) -> None:
|
||||||
recipient_user = get_user_profile_by_id(recipient_user_id)
|
recipient_user = get_user_profile_by_id(recipient_user_id)
|
||||||
recipient_str = recipient_user.email
|
recipient_str = recipient_user.email
|
||||||
internal_send_private_message(user_profile, recipient_user, body)
|
internal_send_private_message(user_profile, recipient_user, body)
|
||||||
elif recipient.type == Recipient.HUDDLE:
|
elif recipient.type == Recipient.DIRECT_MESSAGE_GROUP:
|
||||||
display_recipient = get_display_recipient(recipient)
|
display_recipient = get_display_recipient(recipient)
|
||||||
emails = [user_dict["email"] for user_dict in display_recipient]
|
emails = [user_dict["email"] for user_dict in display_recipient]
|
||||||
recipient_str = ", ".join(emails)
|
recipient_str = ", ".join(emails)
|
||||||
|
|
|
@ -200,7 +200,7 @@ def build_message_list(
|
||||||
messages_to_render: List[Dict[str, Any]] = []
|
messages_to_render: List[Dict[str, Any]] = []
|
||||||
|
|
||||||
def sender_string(message: Message) -> str:
|
def sender_string(message: Message) -> str:
|
||||||
if message.recipient.type in (Recipient.STREAM, Recipient.HUDDLE):
|
if message.recipient.type in (Recipient.STREAM, Recipient.DIRECT_MESSAGE_GROUP):
|
||||||
return message.sender.full_name
|
return message.sender.full_name
|
||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
|
@ -263,7 +263,7 @@ def build_message_list(
|
||||||
)
|
)
|
||||||
header = f"You and {message.sender.full_name}"
|
header = f"You and {message.sender.full_name}"
|
||||||
header_html = f"<a style='color: #ffffff;' href='{narrow_link}'>{header}</a>"
|
header_html = f"<a style='color: #ffffff;' href='{narrow_link}'>{header}</a>"
|
||||||
elif message.recipient.type == Recipient.HUDDLE:
|
elif message.recipient.type == Recipient.DIRECT_MESSAGE_GROUP:
|
||||||
grouping = {"huddle": message.recipient_id}
|
grouping = {"huddle": message.recipient_id}
|
||||||
display_recipient = get_display_recipient(message.recipient)
|
display_recipient = get_display_recipient(message.recipient)
|
||||||
narrow_link = huddle_narrow_url(
|
narrow_link = huddle_narrow_url(
|
||||||
|
@ -470,7 +470,7 @@ def do_send_missedmessage_events_reply_in_zulip(
|
||||||
reply_to_name = "Zulip"
|
reply_to_name = "Zulip"
|
||||||
|
|
||||||
senders = list({m["message"].sender for m in missed_messages})
|
senders = list({m["message"].sender for m in missed_messages})
|
||||||
if missed_messages[0]["message"].recipient.type == Recipient.HUDDLE:
|
if missed_messages[0]["message"].recipient.type == Recipient.DIRECT_MESSAGE_GROUP:
|
||||||
display_recipient = get_display_recipient(missed_messages[0]["message"].recipient)
|
display_recipient = get_display_recipient(missed_messages[0]["message"].recipient)
|
||||||
narrow_url = huddle_narrow_url(
|
narrow_url = huddle_narrow_url(
|
||||||
user=user_profile,
|
user=user_profile,
|
||||||
|
|
|
@ -1107,7 +1107,7 @@ def custom_fetch_huddle_objects(response: TableData, context: Context) -> None:
|
||||||
|
|
||||||
# First we get all huddles involving someone in the realm.
|
# First we get all huddles involving someone in the realm.
|
||||||
realm_huddle_subs = Subscription.objects.select_related("recipient").filter(
|
realm_huddle_subs = Subscription.objects.select_related("recipient").filter(
|
||||||
recipient__type=Recipient.HUDDLE, user_profile__in=user_profile_ids
|
recipient__type=Recipient.DIRECT_MESSAGE_GROUP, user_profile__in=user_profile_ids
|
||||||
)
|
)
|
||||||
realm_huddle_recipient_ids = {sub.recipient_id for sub in realm_huddle_subs}
|
realm_huddle_recipient_ids = {sub.recipient_id for sub in realm_huddle_subs}
|
||||||
|
|
||||||
|
@ -2257,7 +2257,8 @@ def export_messages_single_user(
|
||||||
)
|
)
|
||||||
|
|
||||||
my_subscriptions = Subscription.objects.filter(
|
my_subscriptions = Subscription.objects.filter(
|
||||||
user_profile=user_profile, recipient__type__in=[Recipient.PERSONAL, Recipient.HUDDLE]
|
user_profile=user_profile,
|
||||||
|
recipient__type__in=[Recipient.PERSONAL, Recipient.DIRECT_MESSAGE_GROUP],
|
||||||
)
|
)
|
||||||
my_recipient_ids = [sub.recipient_id for sub in my_subscriptions]
|
my_recipient_ids = [sub.recipient_id for sub in my_subscriptions]
|
||||||
messages_to_me = Message.objects.filter(
|
messages_to_me = Message.objects.filter(
|
||||||
|
|
|
@ -1205,7 +1205,9 @@ def do_import_realm(import_dir: Path, subdomain: str, processes: int = 1) -> Rea
|
||||||
process_huddle_hash(data, "zerver_huddle")
|
process_huddle_hash(data, "zerver_huddle")
|
||||||
bulk_import_model(data, Huddle)
|
bulk_import_model(data, Huddle)
|
||||||
for huddle in Huddle.objects.filter(recipient=None):
|
for huddle in Huddle.objects.filter(recipient=None):
|
||||||
recipient = Recipient.objects.get(type=Recipient.HUDDLE, type_id=huddle.id)
|
recipient = Recipient.objects.get(
|
||||||
|
type=Recipient.DIRECT_MESSAGE_GROUP, type_id=huddle.id
|
||||||
|
)
|
||||||
huddle.recipient = recipient
|
huddle.recipient = recipient
|
||||||
huddle.save(update_fields=["recipient"])
|
huddle.save(update_fields=["recipient"])
|
||||||
|
|
||||||
|
|
|
@ -490,7 +490,7 @@ def get_messages_with_usermessage_rows_for_user(
|
||||||
def huddle_users(recipient_id: int) -> str:
|
def huddle_users(recipient_id: int) -> str:
|
||||||
display_recipient: List[UserDisplayRecipient] = get_display_recipient_by_id(
|
display_recipient: List[UserDisplayRecipient] = get_display_recipient_by_id(
|
||||||
recipient_id,
|
recipient_id,
|
||||||
Recipient.HUDDLE,
|
Recipient.DIRECT_MESSAGE_GROUP,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -672,7 +672,7 @@ def extract_unread_data_from_um_rows(
|
||||||
other_user_id=other_user_id,
|
other_user_id=other_user_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
elif msg_type == Recipient.HUDDLE:
|
elif msg_type == Recipient.DIRECT_MESSAGE_GROUP:
|
||||||
user_ids_string = get_huddle_users(recipient_id)
|
user_ids_string = get_huddle_users(recipient_id)
|
||||||
huddle_dict[message_id] = dict(
|
huddle_dict[message_id] = dict(
|
||||||
user_ids_string=user_ids_string,
|
user_ids_string=user_ids_string,
|
||||||
|
|
|
@ -507,7 +507,7 @@ class MessageDict:
|
||||||
|
|
||||||
if recipient_type == Recipient.STREAM:
|
if recipient_type == Recipient.STREAM:
|
||||||
display_type = "stream"
|
display_type = "stream"
|
||||||
elif recipient_type in (Recipient.HUDDLE, Recipient.PERSONAL):
|
elif recipient_type in (Recipient.DIRECT_MESSAGE_GROUP, Recipient.PERSONAL):
|
||||||
assert not isinstance(display_recipient, str)
|
assert not isinstance(display_recipient, str)
|
||||||
display_type = "private"
|
display_type = "private"
|
||||||
if len(display_recipient) == 1:
|
if len(display_recipient) == 1:
|
||||||
|
|
|
@ -576,7 +576,7 @@ class NarrowBuilder:
|
||||||
raise BadNarrowOperatorError("unknown user in " + str(operand))
|
raise BadNarrowOperatorError("unknown user in " + str(operand))
|
||||||
|
|
||||||
# Group direct message
|
# Group direct message
|
||||||
if recipient.type == Recipient.HUDDLE:
|
if recipient.type == Recipient.DIRECT_MESSAGE_GROUP:
|
||||||
cond = column("recipient_id", Integer) == recipient.id
|
cond = column("recipient_id", Integer) == recipient.id
|
||||||
return query.where(maybe_negate(cond))
|
return query.where(maybe_negate(cond))
|
||||||
|
|
||||||
|
@ -627,14 +627,14 @@ class NarrowBuilder:
|
||||||
recipient_tuple["recipient_id"]
|
recipient_tuple["recipient_id"]
|
||||||
for recipient_tuple in Subscription.objects.filter(
|
for recipient_tuple in Subscription.objects.filter(
|
||||||
user_profile=self.user_profile,
|
user_profile=self.user_profile,
|
||||||
recipient__type=Recipient.HUDDLE,
|
recipient__type=Recipient.DIRECT_MESSAGE_GROUP,
|
||||||
).values("recipient_id")
|
).values("recipient_id")
|
||||||
]
|
]
|
||||||
narrow_recipient_ids = [
|
narrow_recipient_ids = [
|
||||||
recipient_tuple["recipient_id"]
|
recipient_tuple["recipient_id"]
|
||||||
for recipient_tuple in Subscription.objects.filter(
|
for recipient_tuple in Subscription.objects.filter(
|
||||||
user_profile=other_user,
|
user_profile=other_user,
|
||||||
recipient__type=Recipient.HUDDLE,
|
recipient__type=Recipient.DIRECT_MESSAGE_GROUP,
|
||||||
).values("recipient_id")
|
).values("recipient_id")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -994,7 +994,7 @@ def get_message_payload(
|
||||||
data["stream"] = get_message_stream_name_from_database(message)
|
data["stream"] = get_message_stream_name_from_database(message)
|
||||||
data["stream_id"] = message.recipient.type_id
|
data["stream_id"] = message.recipient.type_id
|
||||||
data["topic"] = message.topic_name()
|
data["topic"] = message.topic_name()
|
||||||
elif message.recipient.type == Recipient.HUDDLE:
|
elif message.recipient.type == Recipient.DIRECT_MESSAGE_GROUP:
|
||||||
data["recipient_type"] = "private"
|
data["recipient_type"] = "private"
|
||||||
data["pm_users"] = huddle_users(message.recipient.id)
|
data["pm_users"] = huddle_users(message.recipient.id)
|
||||||
else: # Recipient.PERSONAL
|
else: # Recipient.PERSONAL
|
||||||
|
@ -1007,7 +1007,7 @@ def get_apns_alert_title(message: Message) -> str:
|
||||||
"""
|
"""
|
||||||
On an iOS notification, this is the first bolded line.
|
On an iOS notification, this is the first bolded line.
|
||||||
"""
|
"""
|
||||||
if message.recipient.type == Recipient.HUDDLE:
|
if message.recipient.type == Recipient.DIRECT_MESSAGE_GROUP:
|
||||||
recipients = get_display_recipient(message.recipient)
|
recipients = get_display_recipient(message.recipient)
|
||||||
assert isinstance(recipients, list)
|
assert isinstance(recipients, list)
|
||||||
return ", ".join(sorted(r["full_name"] for r in recipients))
|
return ", ".join(sorted(r["full_name"] for r in recipients))
|
||||||
|
|
|
@ -51,7 +51,7 @@ def get_recipient_from_user_profiles(
|
||||||
huddle = get_or_create_huddle(user_ids)
|
huddle = get_or_create_huddle(user_ids)
|
||||||
return Recipient(
|
return Recipient(
|
||||||
id=huddle.recipient_id,
|
id=huddle.recipient_id,
|
||||||
type=Recipient.HUDDLE,
|
type=Recipient.DIRECT_MESSAGE_GROUP,
|
||||||
type_id=huddle.id,
|
type_id=huddle.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -224,7 +224,7 @@ def move_expired_personal_and_huddle_messages_to_archive(
|
||||||
assert message_retention_days != -1
|
assert message_retention_days != -1
|
||||||
check_date = timezone_now() - timedelta(days=message_retention_days)
|
check_date = timezone_now() - timedelta(days=message_retention_days)
|
||||||
|
|
||||||
recipient_types = (Recipient.PERSONAL, Recipient.HUDDLE)
|
recipient_types = (Recipient.PERSONAL, Recipient.DIRECT_MESSAGE_GROUP)
|
||||||
|
|
||||||
# Archive expired personal and huddle Messages in the realm, including cross-realm messages.
|
# Archive expired personal and huddle Messages in the realm, including cross-realm messages.
|
||||||
# Uses index: zerver_message_realm_recipient_date_sent
|
# Uses index: zerver_message_realm_recipient_date_sent
|
||||||
|
|
|
@ -616,7 +616,7 @@ def use_db_models(
|
||||||
Recipient = apps.get_model("zerver", "Recipient")
|
Recipient = apps.get_model("zerver", "Recipient")
|
||||||
Recipient.PERSONAL = 1
|
Recipient.PERSONAL = 1
|
||||||
Recipient.STREAM = 2
|
Recipient.STREAM = 2
|
||||||
Recipient.HUDDLE = 3
|
Recipient.DIRECT_MESSAGE_GROUP = 3
|
||||||
ScheduledEmail = apps.get_model("zerver", "ScheduledEmail")
|
ScheduledEmail = apps.get_model("zerver", "ScheduledEmail")
|
||||||
ScheduledMessage = apps.get_model("zerver", "ScheduledMessage")
|
ScheduledMessage = apps.get_model("zerver", "ScheduledMessage")
|
||||||
Service = apps.get_model("zerver", "Service")
|
Service = apps.get_model("zerver", "Service")
|
||||||
|
|
|
@ -582,7 +582,7 @@ def check_can_access_user(
|
||||||
subscribed_recipient_ids = Subscription.objects.filter(
|
subscribed_recipient_ids = Subscription.objects.filter(
|
||||||
user_profile=user_profile,
|
user_profile=user_profile,
|
||||||
active=True,
|
active=True,
|
||||||
recipient__type__in=[Recipient.STREAM, Recipient.HUDDLE],
|
recipient__type__in=[Recipient.STREAM, Recipient.DIRECT_MESSAGE_GROUP],
|
||||||
).values_list("recipient_id", flat=True)
|
).values_list("recipient_id", flat=True)
|
||||||
|
|
||||||
if Subscription.objects.filter(
|
if Subscription.objects.filter(
|
||||||
|
@ -628,7 +628,7 @@ def get_inaccessible_user_ids(
|
||||||
subscribed_recipient_ids = Subscription.objects.filter(
|
subscribed_recipient_ids = Subscription.objects.filter(
|
||||||
user_profile=acting_user,
|
user_profile=acting_user,
|
||||||
active=True,
|
active=True,
|
||||||
recipient__type__in=[Recipient.STREAM, Recipient.HUDDLE],
|
recipient__type__in=[Recipient.STREAM, Recipient.DIRECT_MESSAGE_GROUP],
|
||||||
).values_list("recipient_id", flat=True)
|
).values_list("recipient_id", flat=True)
|
||||||
|
|
||||||
common_subscription_user_ids = (
|
common_subscription_user_ids = (
|
||||||
|
@ -701,7 +701,7 @@ def get_subscribers_of_target_user_subscriptions(
|
||||||
Subscription.objects.filter(
|
Subscription.objects.filter(
|
||||||
user_profile__in=target_user_ids,
|
user_profile__in=target_user_ids,
|
||||||
active=True,
|
active=True,
|
||||||
recipient__type__in=[Recipient.STREAM, Recipient.HUDDLE],
|
recipient__type__in=[Recipient.STREAM, Recipient.DIRECT_MESSAGE_GROUP],
|
||||||
)
|
)
|
||||||
.order_by("user_profile_id")
|
.order_by("user_profile_id")
|
||||||
.values("user_profile_id", "recipient_id")
|
.values("user_profile_id", "recipient_id")
|
||||||
|
@ -725,11 +725,12 @@ def get_subscribers_of_target_user_subscriptions(
|
||||||
if include_deactivated_users_for_huddles:
|
if include_deactivated_users_for_huddles:
|
||||||
subs_in_target_user_subscriptions_query = subs_in_target_user_subscriptions_query.filter(
|
subs_in_target_user_subscriptions_query = subs_in_target_user_subscriptions_query.filter(
|
||||||
Q(recipient__type=Recipient.STREAM, is_user_active=True)
|
Q(recipient__type=Recipient.STREAM, is_user_active=True)
|
||||||
| Q(recipient__type=Recipient.HUDDLE)
|
| Q(recipient__type=Recipient.DIRECT_MESSAGE_GROUP)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
subs_in_target_user_subscriptions_query = subs_in_target_user_subscriptions_query.filter(
|
subs_in_target_user_subscriptions_query = subs_in_target_user_subscriptions_query.filter(
|
||||||
recipient__type__in=[Recipient.STREAM, Recipient.HUDDLE], is_user_active=True
|
recipient__type__in=[Recipient.STREAM, Recipient.DIRECT_MESSAGE_GROUP],
|
||||||
|
is_user_active=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
subs_in_target_user_subscriptions = subs_in_target_user_subscriptions_query.order_by(
|
subs_in_target_user_subscriptions = subs_in_target_user_subscriptions_query.order_by(
|
||||||
|
|
|
@ -20,7 +20,7 @@ def set_initial_value_of_is_private_flag(
|
||||||
print("\nStart setting initial value for is_private flag...", flush=True)
|
print("\nStart setting initial value for is_private flag...", flush=True)
|
||||||
while True:
|
while True:
|
||||||
range_end = i + 10000
|
range_end = i + 10000
|
||||||
# Can't use [Recipient.PERSONAL, Recipient.HUDDLE] in migration files
|
# Can't use [Recipient.PERSONAL, Recipient.DIRECT_MESSAGE_GROUP] in migration files
|
||||||
message_ids = list(
|
message_ids = list(
|
||||||
Message.objects.filter(recipient__type__in=[1, 3], id__gt=i, id__lte=range_end)
|
Message.objects.filter(recipient__type__in=[1, 3], id__gt=i, id__lte=range_end)
|
||||||
.values_list("id", flat=True)
|
.values_list("id", flat=True)
|
||||||
|
|
|
@ -47,13 +47,13 @@ class Recipient(models.Model):
|
||||||
# The type for stream messages.
|
# The type for stream messages.
|
||||||
STREAM = 2
|
STREAM = 2
|
||||||
# The type group direct messages.
|
# The type group direct messages.
|
||||||
HUDDLE = 3
|
DIRECT_MESSAGE_GROUP = 3
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ("type", "type_id")
|
unique_together = ("type", "type_id")
|
||||||
|
|
||||||
# N.B. If we used Django's choice=... we would get this for free (kinda)
|
# N.B. If we used Django's choice=... we would get this for free (kinda)
|
||||||
_type_names = {PERSONAL: "personal", STREAM: "stream", HUDDLE: "huddle"}
|
_type_names = {PERSONAL: "personal", STREAM: "stream", DIRECT_MESSAGE_GROUP: "huddle"}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
|
@ -75,7 +75,7 @@ class Recipient(models.Model):
|
||||||
def get_huddle_user_ids(recipient: Recipient) -> ValuesQuerySet["Subscription", int]:
|
def get_huddle_user_ids(recipient: Recipient) -> ValuesQuerySet["Subscription", int]:
|
||||||
from zerver.models import Subscription
|
from zerver.models import Subscription
|
||||||
|
|
||||||
assert recipient.type == Recipient.HUDDLE
|
assert recipient.type == Recipient.DIRECT_MESSAGE_GROUP
|
||||||
|
|
||||||
return (
|
return (
|
||||||
Subscription.objects.filter(
|
Subscription.objects.filter(
|
||||||
|
@ -150,7 +150,9 @@ def get_or_create_huddle(id_list: List[int]) -> Huddle:
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
(huddle, created) = Huddle.objects.get_or_create(huddle_hash=huddle_hash)
|
(huddle, created) = Huddle.objects.get_or_create(huddle_hash=huddle_hash)
|
||||||
if created:
|
if created:
|
||||||
recipient = Recipient.objects.create(type_id=huddle.id, type=Recipient.HUDDLE)
|
recipient = Recipient.objects.create(
|
||||||
|
type_id=huddle.id, type=Recipient.DIRECT_MESSAGE_GROUP
|
||||||
|
)
|
||||||
huddle.recipient = recipient
|
huddle.recipient = recipient
|
||||||
huddle.save(update_fields=["recipient"])
|
huddle.save(update_fields=["recipient"])
|
||||||
subs_to_create = [
|
subs_to_create = [
|
||||||
|
|
|
@ -1081,7 +1081,7 @@ class TestMissedMessageEmailMessages(ZulipTestCase):
|
||||||
|
|
||||||
self.assertEqual(message.content, "TestMissedHuddleMessageEmailMessages body")
|
self.assertEqual(message.content, "TestMissedHuddleMessageEmailMessages body")
|
||||||
self.assertEqual(message.sender, self.example_user("cordelia"))
|
self.assertEqual(message.sender, self.example_user("cordelia"))
|
||||||
self.assertEqual(message.recipient.type, Recipient.HUDDLE)
|
self.assertEqual(message.recipient.type, Recipient.DIRECT_MESSAGE_GROUP)
|
||||||
|
|
||||||
# Confirm Othello received the message.
|
# Confirm Othello received the message.
|
||||||
user_profile = self.example_user("othello")
|
user_profile = self.example_user("othello")
|
||||||
|
@ -1089,7 +1089,7 @@ class TestMissedMessageEmailMessages(ZulipTestCase):
|
||||||
|
|
||||||
self.assertEqual(message.content, "TestMissedHuddleMessageEmailMessages body")
|
self.assertEqual(message.content, "TestMissedHuddleMessageEmailMessages body")
|
||||||
self.assertEqual(message.sender, self.example_user("cordelia"))
|
self.assertEqual(message.sender, self.example_user("cordelia"))
|
||||||
self.assertEqual(message.recipient.type, Recipient.HUDDLE)
|
self.assertEqual(message.recipient.type, Recipient.DIRECT_MESSAGE_GROUP)
|
||||||
|
|
||||||
def test_receive_missed_stream_message_email_messages(self) -> None:
|
def test_receive_missed_stream_message_email_messages(self) -> None:
|
||||||
# build dummy messages for message notification email reply
|
# build dummy messages for message notification email reply
|
||||||
|
|
|
@ -684,7 +684,7 @@ class RealmImportExportTest(ExportFile):
|
||||||
# Third huddle is not exported since none of the members gave consent
|
# Third huddle is not exported since none of the members gave consent
|
||||||
assert huddle_a is not None and huddle_b is not None
|
assert huddle_a is not None and huddle_b is not None
|
||||||
huddle_recipients = Recipient.objects.filter(
|
huddle_recipients = Recipient.objects.filter(
|
||||||
type_id__in=[huddle_a.id, huddle_b.id], type=Recipient.HUDDLE
|
type_id__in=[huddle_a.id, huddle_b.id], type=Recipient.DIRECT_MESSAGE_GROUP
|
||||||
)
|
)
|
||||||
pm_query = Q(recipient__in=huddle_recipients) | Q(sender__in=consented_user_ids)
|
pm_query = Q(recipient__in=huddle_recipients) | Q(sender__in=consented_user_ids)
|
||||||
exported_huddle_ids = (
|
exported_huddle_ids = (
|
||||||
|
@ -984,7 +984,9 @@ class RealmImportExportTest(ExportFile):
|
||||||
# Huddles don't have a realm column, so we just test all Huddles for simplicity.
|
# Huddles don't have a realm column, so we just test all Huddles for simplicity.
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
huddle_object.recipient_id,
|
huddle_object.recipient_id,
|
||||||
Recipient.objects.get(type=Recipient.HUDDLE, type_id=huddle_object.id).id,
|
Recipient.objects.get(
|
||||||
|
type=Recipient.DIRECT_MESSAGE_GROUP, type_id=huddle_object.id
|
||||||
|
).id,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(ScheduledMessage.objects.filter(realm=imported_realm).count(), 1)
|
self.assertEqual(ScheduledMessage.objects.filter(realm=imported_realm).count(), 1)
|
||||||
|
|
|
@ -867,7 +867,9 @@ class MatterMostImporter(ZulipTestCase):
|
||||||
self.assertFalse(stream_messages[3].has_image)
|
self.assertFalse(stream_messages[3].has_image)
|
||||||
self.assertTrue(stream_messages[3].has_link)
|
self.assertTrue(stream_messages[3].has_link)
|
||||||
|
|
||||||
huddle_messages = messages.filter(recipient__type=Recipient.HUDDLE).order_by("date_sent")
|
huddle_messages = messages.filter(recipient__type=Recipient.DIRECT_MESSAGE_GROUP).order_by(
|
||||||
|
"date_sent"
|
||||||
|
)
|
||||||
huddle_recipients = huddle_messages.values_list("recipient", flat=True)
|
huddle_recipients = huddle_messages.values_list("recipient", flat=True)
|
||||||
self.assert_length(huddle_messages, 3)
|
self.assert_length(huddle_messages, 3)
|
||||||
self.assert_length(set(huddle_recipients), 1)
|
self.assert_length(set(huddle_recipients), 1)
|
||||||
|
|
|
@ -1021,7 +1021,9 @@ class RocketChatImporter(ZulipTestCase):
|
||||||
self.assertTrue(stream_messages[23].has_image)
|
self.assertTrue(stream_messages[23].has_image)
|
||||||
self.assertTrue(stream_messages[23].has_link)
|
self.assertTrue(stream_messages[23].has_link)
|
||||||
|
|
||||||
huddle_messages = messages.filter(recipient__type=Recipient.HUDDLE).order_by("date_sent")
|
huddle_messages = messages.filter(recipient__type=Recipient.DIRECT_MESSAGE_GROUP).order_by(
|
||||||
|
"date_sent"
|
||||||
|
)
|
||||||
huddle_recipients = huddle_messages.values_list("recipient", flat=True)
|
huddle_recipients = huddle_messages.values_list("recipient", flat=True)
|
||||||
self.assert_length(huddle_messages, 4)
|
self.assert_length(huddle_messages, 4)
|
||||||
self.assert_length(set(huddle_recipients), 1)
|
self.assert_length(set(huddle_recipients), 1)
|
||||||
|
|
|
@ -2733,7 +2733,7 @@ class DeleteUserTest(ZulipTestCase):
|
||||||
|
|
||||||
huddle_with_hamlet_recipient_ids = list(
|
huddle_with_hamlet_recipient_ids = list(
|
||||||
Subscription.objects.filter(
|
Subscription.objects.filter(
|
||||||
user_profile=hamlet, recipient__type=Recipient.HUDDLE
|
user_profile=hamlet, recipient__type=Recipient.DIRECT_MESSAGE_GROUP
|
||||||
).values_list("recipient_id", flat=True)
|
).values_list("recipient_id", flat=True)
|
||||||
)
|
)
|
||||||
self.assertGreater(len(huddle_with_hamlet_recipient_ids), 0)
|
self.assertGreater(len(huddle_with_hamlet_recipient_ids), 0)
|
||||||
|
@ -2800,7 +2800,7 @@ class DeleteUserTest(ZulipTestCase):
|
||||||
|
|
||||||
huddle_with_hamlet_recipient_ids = list(
|
huddle_with_hamlet_recipient_ids = list(
|
||||||
Subscription.objects.filter(
|
Subscription.objects.filter(
|
||||||
user_profile=hamlet, recipient__type=Recipient.HUDDLE
|
user_profile=hamlet, recipient__type=Recipient.DIRECT_MESSAGE_GROUP
|
||||||
).values_list("recipient_id", flat=True)
|
).values_list("recipient_id", flat=True)
|
||||||
)
|
)
|
||||||
self.assertGreater(len(huddle_with_hamlet_recipient_ids), 0)
|
self.assertGreater(len(huddle_with_hamlet_recipient_ids), 0)
|
||||||
|
|
|
@ -45,7 +45,7 @@ class ZulipUpdateAnnouncementsTest(ZulipTestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
group_direct_messages = Message.objects.filter(
|
group_direct_messages = Message.objects.filter(
|
||||||
realm=realm, recipient__type=Recipient.HUDDLE
|
realm=realm, recipient__type=Recipient.DIRECT_MESSAGE_GROUP
|
||||||
)
|
)
|
||||||
self.assertFalse(group_direct_messages.exists())
|
self.assertFalse(group_direct_messages.exists())
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ class ZulipUpdateAnnouncementsTest(ZulipTestCase):
|
||||||
self.assertIsNotNone(realm.zulip_update_announcements_stream)
|
self.assertIsNotNone(realm.zulip_update_announcements_stream)
|
||||||
|
|
||||||
group_direct_messages = Message.objects.filter(
|
group_direct_messages = Message.objects.filter(
|
||||||
realm=realm, recipient__type=Recipient.HUDDLE
|
realm=realm, recipient__type=Recipient.DIRECT_MESSAGE_GROUP
|
||||||
)
|
)
|
||||||
self.assertFalse(group_direct_messages.exists())
|
self.assertFalse(group_direct_messages.exists())
|
||||||
|
|
||||||
|
|
|
@ -1144,7 +1144,9 @@ def generate_and_send_messages(
|
||||||
recipient.id
|
recipient.id
|
||||||
for recipient in Recipient.objects.filter(type=Recipient.STREAM, type_id__in=stream_ids)
|
for recipient in Recipient.objects.filter(type=Recipient.STREAM, type_id__in=stream_ids)
|
||||||
]
|
]
|
||||||
recipient_huddles: List[int] = [h.id for h in Recipient.objects.filter(type=Recipient.HUDDLE)]
|
recipient_huddles: List[int] = [
|
||||||
|
h.id for h in Recipient.objects.filter(type=Recipient.DIRECT_MESSAGE_GROUP)
|
||||||
|
]
|
||||||
|
|
||||||
huddle_members: Dict[int, List[int]] = {}
|
huddle_members: Dict[int, List[int]] = {}
|
||||||
for h in recipient_huddles:
|
for h in recipient_huddles:
|
||||||
|
@ -1189,10 +1191,10 @@ def generate_and_send_messages(
|
||||||
elif message_type == Recipient.STREAM:
|
elif message_type == Recipient.STREAM:
|
||||||
message.subject = saved_data["subject"]
|
message.subject = saved_data["subject"]
|
||||||
message.recipient = get_recipient_by_id(recipient_id)
|
message.recipient = get_recipient_by_id(recipient_id)
|
||||||
elif message_type == Recipient.HUDDLE:
|
elif message_type == Recipient.DIRECT_MESSAGE_GROUP:
|
||||||
message.recipient = get_recipient_by_id(recipient_id)
|
message.recipient = get_recipient_by_id(recipient_id)
|
||||||
elif randkey <= random_max * options["percent_huddles"] / 100.0:
|
elif randkey <= random_max * options["percent_huddles"] / 100.0:
|
||||||
message_type = Recipient.HUDDLE
|
message_type = Recipient.DIRECT_MESSAGE_GROUP
|
||||||
message.recipient = get_recipient_by_id(random.choice(recipient_huddles))
|
message.recipient = get_recipient_by_id(random.choice(recipient_huddles))
|
||||||
elif (
|
elif (
|
||||||
randkey
|
randkey
|
||||||
|
@ -1205,7 +1207,7 @@ def generate_and_send_messages(
|
||||||
message_type = Recipient.STREAM
|
message_type = Recipient.STREAM
|
||||||
message.recipient = get_recipient_by_id(random.choice(recipient_streams))
|
message.recipient = get_recipient_by_id(random.choice(recipient_streams))
|
||||||
|
|
||||||
if message_type == Recipient.HUDDLE:
|
if message_type == Recipient.DIRECT_MESSAGE_GROUP:
|
||||||
sender_id = random.choice(huddle_members[message.recipient.id])
|
sender_id = random.choice(huddle_members[message.recipient.id])
|
||||||
message.sender = get_user_profile_by_id(sender_id)
|
message.sender = get_user_profile_by_id(sender_id)
|
||||||
elif message_type == Recipient.PERSONAL:
|
elif message_type == Recipient.PERSONAL:
|
||||||
|
|
Loading…
Reference in New Issue