mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-02-08 06:19:29 +01:00
Simplify return statement
Rename `ticket` to `ticket_id` for clarity
This commit is contained in:
parent
0b1de1eead
commit
80f4152301
@ -531,20 +531,18 @@ def object_from_message(message, queue, logger):
|
|||||||
|
|
||||||
for ignore in IgnoreEmail.objects.filter(Q(queues=queue) | Q(queues__isnull=True)):
|
for ignore in IgnoreEmail.objects.filter(Q(queues=queue) | Q(queues__isnull=True)):
|
||||||
if ignore.test(sender_email):
|
if ignore.test(sender_email):
|
||||||
if ignore.keep_in_mailbox:
|
|
||||||
# By returning 'False' the message will be kept in the mailbox,
|
# By returning 'False' the message will be kept in the mailbox,
|
||||||
# and the 'True' will cause the message to be deleted.
|
# and the 'True' will cause the message to be deleted.
|
||||||
return False
|
return not ignore.keep_in_mailbox
|
||||||
return True
|
|
||||||
|
|
||||||
matchobj = re.match(r".*\[" + queue.slug + r"-(?P<id>\d+)\]", subject)
|
matchobj = re.match(r".*\[" + queue.slug + r"-(?P<id>\d+)\]", subject)
|
||||||
if matchobj:
|
if matchobj:
|
||||||
# This is a reply or forward.
|
# This is a reply or forward.
|
||||||
ticket = matchobj.group('id')
|
ticket_id = matchobj.group('id')
|
||||||
logger.info("Matched tracking ID %s-%s" % (queue.slug, ticket))
|
logger.info("Matched tracking ID %s-%s" % (queue.slug, ticket_id))
|
||||||
else:
|
else:
|
||||||
logger.info("No tracking ID matched.")
|
logger.info("No tracking ID matched.")
|
||||||
ticket = None
|
ticket_id = None
|
||||||
|
|
||||||
body = None
|
body = None
|
||||||
full_body = None
|
full_body = None
|
||||||
@ -568,7 +566,7 @@ def object_from_message(message, queue, logger):
|
|||||||
body = decodeUnknown(part.get_content_charset(), body)
|
body = decodeUnknown(part.get_content_charset(), body)
|
||||||
# have to use django_settings here so overwritting it works in tests
|
# have to use django_settings here so overwritting it works in tests
|
||||||
# the default value is False anyway
|
# the default value is False anyway
|
||||||
if ticket is None and getattr(django_settings, 'HELPDESK_FULL_FIRST_MESSAGE_FROM_EMAIL', False):
|
if ticket_id is None and getattr(django_settings, 'HELPDESK_FULL_FIRST_MESSAGE_FROM_EMAIL', False):
|
||||||
# first message in thread, we save full body to avoid
|
# first message in thread, we save full body to avoid
|
||||||
# losing forwards and things like that
|
# losing forwards and things like that
|
||||||
body_parts = []
|
body_parts = []
|
||||||
@ -690,4 +688,4 @@ def object_from_message(message, queue, logger):
|
|||||||
'files': files,
|
'files': files,
|
||||||
}
|
}
|
||||||
|
|
||||||
return create_object_from_email_message(message, ticket, payload, files, logger=logger)
|
return create_object_from_email_message(message, ticket_id, payload, files, logger=logger)
|
||||||
|
Loading…
Reference in New Issue
Block a user