generated from nathanwoodburn/python-webserver-template
fix: Allow deleting emails sent to e.hns.au emails
All checks were successful
Build Docker / BuildImage (push) Successful in 37s
All checks were successful
Build Docker / BuildImage (push) Successful in 37s
This commit is contained in:
parent
5c6f049fb4
commit
3b118e6923
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user