From: Gael Le Mignot Date: Fri, 2 Jul 2021 07:49:51 +0000 (+0200) Subject: Fixed history : use 100 last and not 100 first messages X-Git-Tag: 2.3~26 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=4c3043a2a00c42758293d4671183e7a6ec4a2942;p=teleforma.git Fixed history : use 100 last and not 100 first messages --- diff --git a/teleforma/views/core.py b/teleforma/views/core.py index 267762de..d50ba776 100644 --- a/teleforma/views/core.py +++ b/teleforma/views/core.py @@ -829,7 +829,8 @@ class ChatMessageView(APIView): You need to provide a room_name in request """ messages = [message.to_dict() for message in ChatMessage.objects.filter( - room_name=request.GET['room_name']).order_by('created')[:100]] + room_name=request.GET['room_name']).order_by('-created')[:100]] + messages = messages[::-1] return Response(messages) def post(self, request):