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