fix unread mesage from a deleted account

This commit is contained in:
2024-11-15 22:02:17 +01:00
parent 194bced58c
commit 296bebb8a0

View File

@ -6,7 +6,7 @@
# By: tomoron <tomoron@student.42.fr> +#+ +:+ +#+ # # By: tomoron <tomoron@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2024/09/28 20:03:49 by tomoron #+# #+# # # Created: 2024/09/28 20:03:49 by tomoron #+# #+# #
# Updated: 2024/09/29 03:09:32 by tomoron ### ########.fr # # Updated: 2024/11/15 22:00:54 by tomoron ### ########.fr #
# # # #
# **************************************************************************** # # **************************************************************************** #
@ -19,7 +19,7 @@ def getUnreadStatus(uid):
if(uid == None or uid == 0): if(uid == None or uid == 0):
return(False) return(False)
user = User.objects.get(id=uid) user = User.objects.get(id=uid)
return(Message.objects.filter(Q(to=user) & Q(read=False)).exists()) return(Message.objects.filter(Q(to=user) & Q(read=False) & Q(sender__isnull=False)).exists())
async def statusMessage(socket,content): async def statusMessage(socket,content):
try: try: