From 6b2a71c4c6c295bfa7c91098f7c2713f0fc1e7f9 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sun, 10 Mar 2024 23:45:37 +0200 Subject: [PATCH] removed unused --- files/routes/private_chats.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/files/routes/private_chats.py b/files/routes/private_chats.py index be7d123eb..0b56ad37c 100644 --- a/files/routes/private_chats.py +++ b/files/routes/private_chats.py @@ -66,13 +66,12 @@ def private_chat(v, chat_id): 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( + notifs = g.db.query(ChatNotification).filter( ChatNotification.user_id == v.id, ChatNotification.chat_id == chat.id, ).all() - for notif, msg in notifs_msgs: - msg.unread = True - g.db.delete(notif) + for n in notifs: + g.db.delete(n) g.db.commit() #to clear notif count return render_template("private_chat.html", v=v, messages=displayed_messages, chat=chat)