Skip to content

Commit

Permalink
naming fix
Browse files Browse the repository at this point in the history
  • Loading branch information
smithellis committed Apr 19, 2024
1 parent 82c249a commit cb970fc
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions kitsune/messages/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ def send_message(to, text=None, sender=None):
# We need a sender, a message, and someone to send it to
if not sender or not text or not to:
return
# User pks from users in To field
usernames = []
group_names = []
# Separate users and groups
users = []
groups = []

for obj in to:
if isinstance(obj, User):
usernames.append(obj)
users.append(obj)
else:
group_names.append(obj)
groups.append(obj)

groups_qs = Group.objects.filter(name__in=group_names)
users_qs = User.objects.filter(username__in=usernames).values_list("id", flat=True)
groups_qs = Group.objects.filter(name__in=groups)
users_qs = User.objects.filter(username__in=users).values_list("id", flat=True)

# Group users' pks only - could be a lot of them
group_users_qs = User.objects.filter(groups__in=groups_qs).values_list("id", flat=True)
Expand Down

0 comments on commit cb970fc

Please sign in to comment.