mirror of
https://github.com/zulip/zulip.git
synced 2025-11-21 06:58:31 +00:00
refactor: Rename user_ids -> message_to_user_ids.
This renaming sets the stage for the next change (and passes all tests).
This commit is contained in:
@@ -809,8 +809,8 @@ def get_recipient_info(recipient, sender_id, stream_topic):
|
|||||||
if recipient.type == Recipient.PERSONAL:
|
if recipient.type == Recipient.PERSONAL:
|
||||||
# The sender and recipient may be the same id, so
|
# The sender and recipient may be the same id, so
|
||||||
# de-duplicate using a set.
|
# de-duplicate using a set.
|
||||||
user_ids = list({recipient.type_id, sender_id})
|
message_to_user_ids = list({recipient.type_id, sender_id})
|
||||||
assert(len(user_ids) in [1, 2])
|
assert(len(message_to_user_ids) in [1, 2])
|
||||||
|
|
||||||
elif recipient.type == Recipient.STREAM:
|
elif recipient.type == Recipient.STREAM:
|
||||||
subscription_rows = Subscription.objects.filter(
|
subscription_rows = Subscription.objects.filter(
|
||||||
@@ -822,7 +822,7 @@ def get_recipient_info(recipient, sender_id, stream_topic):
|
|||||||
'in_home_view',
|
'in_home_view',
|
||||||
).order_by('user_profile_id')
|
).order_by('user_profile_id')
|
||||||
|
|
||||||
user_ids = [
|
message_to_user_ids = [
|
||||||
row['user_profile_id']
|
row['user_profile_id']
|
||||||
for row in subscription_rows
|
for row in subscription_rows
|
||||||
]
|
]
|
||||||
@@ -835,7 +835,7 @@ def get_recipient_info(recipient, sender_id, stream_topic):
|
|||||||
} - stream_topic.user_ids_muting_topic()
|
} - stream_topic.user_ids_muting_topic()
|
||||||
|
|
||||||
elif recipient.type == Recipient.HUDDLE:
|
elif recipient.type == Recipient.HUDDLE:
|
||||||
user_ids = Subscription.objects.filter(
|
message_to_user_ids = Subscription.objects.filter(
|
||||||
recipient=recipient,
|
recipient=recipient,
|
||||||
active=True,
|
active=True,
|
||||||
).order_by('user_profile_id').values_list('user_profile_id', flat=True)
|
).order_by('user_profile_id').values_list('user_profile_id', flat=True)
|
||||||
@@ -843,6 +843,9 @@ def get_recipient_info(recipient, sender_id, stream_topic):
|
|||||||
else:
|
else:
|
||||||
raise ValueError('Bad recipient type')
|
raise ValueError('Bad recipient type')
|
||||||
|
|
||||||
|
user_ids = message_to_user_ids
|
||||||
|
# TODO: add mentioned users
|
||||||
|
|
||||||
if user_ids:
|
if user_ids:
|
||||||
query = UserProfile.objects.filter(
|
query = UserProfile.objects.filter(
|
||||||
is_active=True,
|
is_active=True,
|
||||||
|
|||||||
Reference in New Issue
Block a user