From f75c2a391f97171bdb5ebb4b887abe68958fcf7b Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Tue, 5 Dec 2023 20:06:56 -0600 Subject: [PATCH] Fix chat last message body --- chat_box/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chat_box/models.py b/chat_box/models.py index fd35430..9ede6db 100644 --- a/chat_box/models.py +++ b/chat_box/models.py @@ -27,7 +27,7 @@ class Room(models.Model): @cache_wrapper(prefix="Rinfo") def _info(self): - last_msg = self.message_set.first() + last_msg = self.message_set.filter(hidden=False).first() return { "user_ids": [self.user_one.id, self.user_two.id], "last_message": last_msg.body if last_msg else None,