Exclude ignored users in chat
This commit is contained in:
parent
bc40d293d6
commit
3bf3754baf
1 changed files with 3 additions and 0 deletions
|
@ -438,9 +438,12 @@ def get_unread_boxes(request):
|
||||||
if (request.method != 'GET'):
|
if (request.method != 'GET'):
|
||||||
return HttpResponseBadRequest()
|
return HttpResponseBadRequest()
|
||||||
|
|
||||||
|
ignored_users = Ignore.get_ignored_users(request.profile)
|
||||||
|
|
||||||
mess = Message.objects.filter(room=OuterRef('room'),
|
mess = Message.objects.filter(room=OuterRef('room'),
|
||||||
time__gte=OuterRef('last_seen'))\
|
time__gte=OuterRef('last_seen'))\
|
||||||
.exclude(author=request.profile)\
|
.exclude(author=request.profile)\
|
||||||
|
.exclude(author__in=ignored_users)\
|
||||||
.order_by().values('room')\
|
.order_by().values('room')\
|
||||||
.annotate(unread_count=Count('pk')).values('unread_count')
|
.annotate(unread_count=Count('pk')).values('unread_count')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue