From 995c2a6ef21af573d966f78766994db25b1ab964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alban=20F=C3=A9ron?= Date: Fri, 23 Dec 2022 14:39:15 +0100 Subject: [PATCH] Porting supysonic.api.chat --- supysonic/api/chat.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/supysonic/api/chat.py b/supysonic/api/chat.py index b5a2be9..5135d71 100644 --- a/supysonic/api/chat.py +++ b/supysonic/api/chat.py @@ -1,7 +1,7 @@ # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # -# Copyright (C) 2013-2018 Alban 'spl0k' Féron +# Copyright (C) 2013-2022 Alban 'spl0k' Féron # # Distributed under terms of the GNU AGPLv3 license. @@ -18,7 +18,7 @@ def get_chat(): query = ChatMessage.select().order_by(ChatMessage.time) if since: - query = query.filter(lambda m: m.time > since) + query = query.where(ChatMessage.time > since) return request.formatter( "chatMessages", {"chatMessage": [msg.responsize() for msg in query]} @@ -28,6 +28,6 @@ def get_chat(): @api_routing("/addChatMessage") def add_chat_message(): msg = request.values["message"] - ChatMessage(user=request.user, message=msg) + ChatMessage.create(user=request.user, message=msg) return request.formatter.empty