when the 'X-Spam' flag is set in the mail header, set the state to 'pending_suspected_spam' and do not send auto-reply
All checks were successful
/ test (push) Successful in 2m37s
All checks were successful
/ test (push) Successful in 2m37s
This commit is contained in:
parent
9395226c5f
commit
554bc70413
3 changed files with 55 additions and 6 deletions
|
@ -16,6 +16,7 @@ STATE_CHOICES = (
|
|||
('pending_physical_confirmation', 'Needs to be confirmed physically'),
|
||||
('pending_return', 'Needs to be returned'),
|
||||
('pending_postponed', 'Postponed'),
|
||||
('pending_suspected_spam', 'Suspected Spam'),
|
||||
('waiting_details', 'Waiting for details'),
|
||||
('waiting_pre_shipping', 'Waiting for Address/Shipping Info'),
|
||||
('closed_returned', 'Closed: Returned'),
|
||||
|
@ -46,6 +47,11 @@ class IssueThread(SoftDeleteModel):
|
|||
event = models.ForeignKey(Event, null=True, on_delete=models.SET_NULL, related_name='issue_threads')
|
||||
manually_created = models.BooleanField(default=False)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if 'initial_state' in kwargs:
|
||||
self._initial_state = kwargs.pop('initial_state')
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def short_uuid(self):
|
||||
return self.uuid[:8]
|
||||
|
||||
|
@ -110,8 +116,9 @@ def set_uuid(sender, instance, **kwargs):
|
|||
|
||||
@receiver(post_save, sender=IssueThread)
|
||||
def create_issue_thread(sender, instance, created, **kwargs):
|
||||
if created:
|
||||
StateChange.objects.create(issue_thread=instance, state='pending_new')
|
||||
if created and instance.state_changes.count() == 0:
|
||||
initial_state = getattr(instance, '_initial_state', None)
|
||||
StateChange.objects.create(issue_thread=instance, state=initial_state if initial_state else 'pending_new')
|
||||
|
||||
|
||||
class Comment(models.Model):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue