fix: Allow deleting emails sent to e.hns.au emails
All checks were successful
Build Docker / BuildImage (push) Successful in 37s

This commit is contained in:
Nathan Woodburn 2024-10-09 16:04:31 +11:00
parent 5c6f049fb4
commit 3b118e6923
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -228,9 +228,11 @@ def delete_email(conversation_id, email):
headers = { headers = {
"X-FreeScout-API-Key": os.getenv("FREESCOUT_API_KEY"), "X-FreeScout-API-Key": os.getenv("FREESCOUT_API_KEY"),
} }
altemail:str = f"{email.split('@')[0]}@e.hns.au"
for thread in conversation: for thread in conversation:
for message in thread["messages"]: for message in thread["messages"]:
if email in message["to"]: if email in message["to"] or altemail in message["to"]:
requests.delete( requests.delete(
f"https://ticket.woodburn.au/api/conversations/{thread['id']}", headers=headers) f"https://ticket.woodburn.au/api/conversations/{thread['id']}", headers=headers)
clear_cache() clear_cache()