# apps/comments/signals.py
from django.db.models.signals import post_save
from django.dispatch import receiver
from .models import Comment


@receiver(post_save, sender=Comment)
def handle_new_comment(sender, instance, created, **kwargs):
    if created:
        # 发送审核通知
        if instance.status == Comment.ApprovalStatus.PENDING:
            send_moderation_alert(instance)

        # 通知被回复用户
        if instance.parent:
            notify_reply(instance.parent.user, instance)
