diff --git a/osinaweb/osichat/__pycache__/models.cpython-310.pyc b/osinaweb/osichat/__pycache__/models.cpython-310.pyc index fc8adef4..af06a981 100644 Binary files a/osinaweb/osichat/__pycache__/models.cpython-310.pyc and b/osinaweb/osichat/__pycache__/models.cpython-310.pyc differ diff --git a/osinaweb/osichat/models.py b/osinaweb/osichat/models.py index ff5eb5ef..232add82 100644 --- a/osinaweb/osichat/models.py +++ b/osinaweb/osichat/models.py @@ -285,7 +285,7 @@ class ChatRoomGuest(models.Model): super().save(*args, **kwargs) self.send_chat_notification() def send_chat_notification(self): - type_id = self.id + type_id = self.room.id session_id = self.visitor.session_id title = "New chat on Ositcom!" body = f"Visitor {self.visitor.ip_address} started a new chat on Ositcom" @@ -336,7 +336,7 @@ class ChatMessage(models.Model): if not self.member: self.send_message_notification() def send_message_notification(self): - type_id = self.id + type_id = self.room.id session_id = self.room.chatroomguest.visitor.session_id title = f"Visitor {self.room.chatroomguest.visitor.ip_address} sent a new message on Ositcom!" body = f"{self.content}" diff --git a/osinaweb/static/js/osichat/conversation.js b/osinaweb/static/js/osichat/conversation.js index 02ba396b..3cb0c552 100644 --- a/osinaweb/static/js/osichat/conversation.js +++ b/osinaweb/static/js/osichat/conversation.js @@ -155,7 +155,7 @@ function handleLoadChatEvent(data, osichatSocket) { scrollBottom(); - if (isOpen) { // If chat widget isOpen (declared in chat-toggle.js) mark all messages as read by guest else just return number of unread messages + if (isOpen) { // If chat widget isOpen mark all messages as read by guest else just return number of unread messages osichatSocket.send(JSON.stringify({ 'event_type': 'update_read_messages', 'chat_state': 'open' })); } else { osichatSocket.send(JSON.stringify({ 'event_type': 'update_read_messages', 'chat_state': 'closed' }));