2023-07-26 11:36:15 +00:00
|
|
|
from django.db.models.signals import post_save
|
|
|
|
from django.dispatch import receiver
|
|
|
|
|
|
|
|
from terminal.models import SessionSharing
|
|
|
|
from terminal.notifications import SessionSharingMessage
|
2024-02-06 10:28:31 +00:00
|
|
|
from terminal.session_lifecycle import UserCreateShareLink
|
2023-07-26 11:36:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
@receiver(post_save, sender=SessionSharing)
|
|
|
|
def on_session_sharing_created(sender, instance: SessionSharing, created, **kwargs):
|
|
|
|
if not created:
|
|
|
|
return
|
|
|
|
for user in instance.users_queryset:
|
|
|
|
SessionSharingMessage(user, instance).publish_async()
|
2024-02-06 10:28:31 +00:00
|
|
|
|
|
|
|
# 创建会话分享活动日志
|
|
|
|
session = instance.session
|
|
|
|
UserCreateShareLink(session, None).create_activity_log()
|