Ticket-reply notification receiver skips raw saves (loaddata made 5 duplicate notifications)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 11:59:26 +03:30
parent ddc6c7c9b7
commit 92dcce901b
2 changed files with 13 additions and 2 deletions

View File

@@ -16,3 +16,13 @@ class RawSaveTests(TestCase):
answer = UserAnswer(user_id=1, question=q, choice=c, correct=True)
post_save.send(UserAnswer, instance=answer, created=True, raw=True)
self.assertEqual(NodeProgress.objects.count(), 0)
class RawTicketReplyTests(TestCase):
def test_raw_support_reply_creates_no_notification(self):
from notifications.models import Notification
from support.models import Ticket, TicketMessage
t = Ticket.objects.create(user_id=1, subject='s')
m = TicketMessage(ticket=t, sender='support', text='x')
post_save.send(TicketMessage, instance=m, created=True, raw=True)
self.assertEqual(Notification.objects.count(), 0)