|
|
|
@ -180,16 +180,27 @@ class TicketRoomConsumer(WebsocketConsumer):
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def user_connection_handler(self, event):
|
|
|
|
|
context = {
|
|
|
|
|
'connections': event['connections'],
|
|
|
|
|
'user': event['user']
|
|
|
|
|
}
|
|
|
|
|
html = render_to_string("details_templates/partials/ticket-online-users.html", context=context)
|
|
|
|
|
self.send(text_data=json.dumps({
|
|
|
|
|
'event_type': 'useer_status',
|
|
|
|
|
'html': html
|
|
|
|
|
}))
|
|
|
|
|
try:
|
|
|
|
|
connections = event.get('connections')
|
|
|
|
|
user = event.get('user')
|
|
|
|
|
|
|
|
|
|
if connections is None or user is None:
|
|
|
|
|
raise ValueError("Event data missing 'connections' or 'user'")
|
|
|
|
|
|
|
|
|
|
context = {
|
|
|
|
|
'connections': connections,
|
|
|
|
|
'user': user
|
|
|
|
|
}
|
|
|
|
|
html = render_to_string("details_templates/partials/ticket-online-users.html", context=context)
|
|
|
|
|
self.send(text_data=json.dumps({
|
|
|
|
|
'event_type': 'user_status',
|
|
|
|
|
'html': html
|
|
|
|
|
}))
|
|
|
|
|
except Exception as e:
|
|
|
|
|
self.send(text_data=json.dumps({
|
|
|
|
|
'event_type': 'error',
|
|
|
|
|
'message': str(e)
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|