From 3bf3754baf0e0074077b72b6696c6bf5888b443a Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Thu, 10 Mar 2022 22:30:58 -0600 Subject: [PATCH] Exclude ignored users in chat --- chat_box/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chat_box/views.py b/chat_box/views.py index f64fb15..49e5a4d 100644 --- a/chat_box/views.py +++ b/chat_box/views.py @@ -438,9 +438,12 @@ def get_unread_boxes(request): if (request.method != 'GET'): return HttpResponseBadRequest() + ignored_users = Ignore.get_ignored_users(request.profile) + mess = Message.objects.filter(room=OuterRef('room'), time__gte=OuterRef('last_seen'))\ .exclude(author=request.profile)\ + .exclude(author__in=ignored_users)\ .order_by().values('room')\ .annotate(unread_count=Count('pk')).values('unread_count')