train spam on state change to 'closed_spam'
This commit is contained in:
parent
a6a8b0defe
commit
32028ba939
2 changed files with 5 additions and 2 deletions
|
@ -13,8 +13,9 @@ class Migration(migrations.Migration):
|
||||||
Email = apps.get_model('mail', 'Email')
|
Email = apps.get_model('mail', 'Email')
|
||||||
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)
|
print("raw_content size:", len(raw_content))
|
||||||
email.raw = None
|
path = "mail_{}".format(email.id)
|
||||||
|
email.raw_file.save(path, ContentFile(raw_content))
|
||||||
email.save()
|
email.save()
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -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):
|
||||||
|
|
Loading…
Add table
Reference in a new issue