emile 7 months ago
parent 68124b85de
commit 787af8b268

@ -305,9 +305,8 @@ class ChatMessage(models.Model):
self.send_message_notification()
def send_message_notification(self):
type_id = self.room.id
chatroom_guest = getattr(self.room, 'chatroomguest', None)
if chatroom_guest:
if self.room.chatroomguest:
session_id = self.room.chatroomguest.visitor.session_id
notification = ChatNotification.objects.create(
title=f"Visitor {self.room.chatroomguest.visitor.ip_address} sent a new message on Ositcom!",
@ -325,6 +324,7 @@ class ChatMessage(models.Model):
notification = ChatNotification.objects.create(
title=f"New message from {self.member.first_name} {self.member.last_name}!",
message= f"{self.content}",
image = user.staffprofile.image.url if user.staffprofile and user.staffprofile.image else None,
type="Chat",
type_id=self.room.id,
user=user

Loading…
Cancel
Save