train spam on state change to 'closed_spam'

This commit is contained in:
j3d1 2024-11-09 01:00:53 +01:00
parent a6a8b0defe
commit 2d8afc373f
2 changed files with 2 additions and 1 deletions

View file

@ -14,7 +14,6 @@ class Migration(migrations.Migration):
for email in Email.objects.all(): for email in Email.objects.all():
raw_content = email.raw raw_content = email.raw
email.raw_file = ContentFile(raw_content) email.raw_file = ContentFile(raw_content)
email.raw = None
email.save() email.save()
operations = [ operations = [

View file

@ -60,6 +60,8 @@ class IssueThread(SoftDeleteModel):
if self.state == value: if self.state == value:
return return
self.state_changes.create(state=value) self.state_changes.create(state=value)
if value == 'closed_spam' and self.emails.exists():
self.emails.first().train_spam()
@property @property
def assigned_to(self): def assigned_to(self):