From 2d8afc373f6f07ca571db27d1ec405a03f08e11a Mon Sep 17 00:00:00 2001 From: jedi Date: Sat, 9 Nov 2024 01:00:53 +0100 Subject: [PATCH] train spam on state change to 'closed_spam' --- core/mail/migrations/0006_email_raw_file.py | 1 - core/tickets/models.py | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/mail/migrations/0006_email_raw_file.py b/core/mail/migrations/0006_email_raw_file.py index 1288bcf..9f3d29c 100644 --- a/core/mail/migrations/0006_email_raw_file.py +++ b/core/mail/migrations/0006_email_raw_file.py @@ -14,7 +14,6 @@ class Migration(migrations.Migration): for email in Email.objects.all(): raw_content = email.raw email.raw_file = ContentFile(raw_content) - email.raw = None email.save() operations = [ diff --git a/core/tickets/models.py b/core/tickets/models.py index db427fe..aff5d6c 100644 --- a/core/tickets/models.py +++ b/core/tickets/models.py @@ -60,6 +60,8 @@ class IssueThread(SoftDeleteModel): if self.state == value: return self.state_changes.create(state=value) + if value == 'closed_spam' and self.emails.exists(): + self.emails.first().train_spam() @property def assigned_to(self):