From b08b8421c32e0680fd0d67f22dec7ea6bbbb47da Mon Sep 17 00:00:00 2001 From: Aevann Date: Sun, 10 Mar 2024 17:35:46 +0200 Subject: [PATCH] order messages --- files/routes/private_chats.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/private_chats.py b/files/routes/private_chats.py index f47e68291..3c03c8aa5 100644 --- a/files/routes/private_chats.py +++ b/files/routes/private_chats.py @@ -63,7 +63,7 @@ def private_chat(v, chat_id): if not is_member: abort(403, "You're not a member of this chat!") - displayed_messages = g.db.query(ChatMessage).filter_by(chat_id=chat.id).limit(250).all() + displayed_messages = reversed(g.db.query(ChatMessage).filter_by(chat_id=chat.id).order_by(ChatMessage.id.desc()).limit(250).all()) displayed_messages = {m.id: m for m in displayed_messages} notifs_msgs = g.db.query(ChatNotification, ChatMessage).join(ChatNotification.chat_message).filter(