emile 7 months ago
parent e76bb0299d
commit 349556575c

Binary file not shown.

@ -202,12 +202,14 @@ class Osichat(WebsocketConsumer):
if self.client_type == 'mobile_admin': if self.client_type == 'mobile_admin':
chat_rooms_data = [] chat_rooms_data = []
for chat_room in chat_rooms: for chat_room in chat_rooms:
last_message = ChatMessage.objects.filter(room=chat_room).last()
chat_room_data = { chat_room_data = {
'id': chat_room.id, 'id': chat_room.id,
'name': chat_room.name, 'name': chat_room.name,
'last_update': chat_room.last_updated, 'last_update': chat_room.last_updated,
'date_created': chat_room.date_created, '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() members = chat_room.chatmember_set.all()
member_data = [] member_data = []

Loading…
Cancel
Save