Fix bug comparing latest message in room chat (#106)
This commit is contained in:
parent
f7fa1c01cb
commit
458598b1cb
1 changed files with 7 additions and 9 deletions
|
@ -181,15 +181,13 @@ def check_valid_message(request, room):
|
||||||
if not can_access_room(request, room) or request.profile.mute:
|
if not can_access_room(request, room) or request.profile.mute:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
|
||||||
last_msg = Message.objects.filter(room=room).first()
|
last_msg = Message.objects.filter(room=room).first()
|
||||||
if (
|
if (
|
||||||
last_msg.author == request.profile
|
last_msg
|
||||||
|
and last_msg.author == request.profile
|
||||||
and last_msg.body == request.POST["body"].strip()
|
and last_msg.body == request.POST["body"].strip()
|
||||||
):
|
):
|
||||||
return False
|
return False
|
||||||
except Message.DoesNotExist:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if not room:
|
if not room:
|
||||||
four_last_msg = Message.objects.filter(room=room).order_by("-id")[:4]
|
four_last_msg = Message.objects.filter(room=room).order_by("-id")[:4]
|
||||||
|
|
Loading…
Reference in a new issue