diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index d8d2eafed7..8ee1a63456 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -809,8 +809,8 @@ def get_recipient_info(recipient, sender_id, stream_topic): if recipient.type == Recipient.PERSONAL: # The sender and recipient may be the same id, so # de-duplicate using a set. - user_ids = list({recipient.type_id, sender_id}) - assert(len(user_ids) in [1, 2]) + message_to_user_ids = list({recipient.type_id, sender_id}) + assert(len(message_to_user_ids) in [1, 2]) elif recipient.type == Recipient.STREAM: subscription_rows = Subscription.objects.filter( @@ -822,7 +822,7 @@ def get_recipient_info(recipient, sender_id, stream_topic): 'in_home_view', ).order_by('user_profile_id') - user_ids = [ + message_to_user_ids = [ row['user_profile_id'] for row in subscription_rows ] @@ -835,7 +835,7 @@ def get_recipient_info(recipient, sender_id, stream_topic): } - stream_topic.user_ids_muting_topic() elif recipient.type == Recipient.HUDDLE: - user_ids = Subscription.objects.filter( + message_to_user_ids = Subscription.objects.filter( recipient=recipient, active=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: raise ValueError('Bad recipient type') + user_ids = message_to_user_ids + # TODO: add mentioned users + if user_ids: query = UserProfile.objects.filter( is_active=True,