Fix bug comparing latest message in room chat (#106)

This commit is contained in:
Phuoc Anh Kha Le 2024-01-28 22:22:57 -06:00 committed by GitHub
parent f7fa1c01cb
commit 458598b1cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -181,15 +181,13 @@ def check_valid_message(request, room):
if not can_access_room(request, room) or request.profile.mute:
return False
try:
last_msg = Message.objects.filter(room=room).first()
if (
last_msg.author == request.profile
last_msg
and last_msg.author == request.profile
and last_msg.body == request.POST["body"].strip()
):
return False
except Message.DoesNotExist:
pass
if not room:
four_last_msg = Message.objects.filter(room=room).order_by("-id")[:4]