diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3 index a28c7aed..061d8e95 100644 Binary files a/osinaweb/db.sqlite3 and b/osinaweb/db.sqlite3 differ diff --git a/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc b/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc index 074071d8..ac3d547e 100644 Binary files a/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc and b/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc differ diff --git a/osinaweb/osichat/consumers.py b/osinaweb/osichat/consumers.py index 1b9a9266..2e9f1d42 100644 --- a/osinaweb/osichat/consumers.py +++ b/osinaweb/osichat/consumers.py @@ -202,12 +202,14 @@ class Osichat(WebsocketConsumer): if self.client_type == 'mobile_admin': chat_rooms_data = [] for chat_room in chat_rooms: + last_message = ChatMessage.objects.filter(room=chat_room).last() chat_room_data = { 'id': chat_room.id, 'name': chat_room.name, 'last_update': chat_room.last_updated, 'date_created': chat_room.date_created, - + 'unread_messages': chat_room.unread_messages(self.scope["user"]), + 'last_message': model_to_dict(last_message) if last_message else None } members = chat_room.chatmember_set.all() member_data = []