generated from nathanwoodburn/python-webserver-template
Compare commits
2 Commits
5c6f049fb4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
415806e852
|
|||
|
3b118e6923
|
@@ -206,6 +206,9 @@ def get_notification_settings(email):
|
||||
if not os.path.exists(notification_file):
|
||||
return False
|
||||
|
||||
# Reformat email
|
||||
email = email.split('@')[0] + '@login.hns.au'
|
||||
|
||||
with open(notification_file, "r") as f:
|
||||
data = json.load(f)
|
||||
if email not in data:
|
||||
@@ -228,9 +231,11 @@ def delete_email(conversation_id, email):
|
||||
headers = {
|
||||
"X-FreeScout-API-Key": os.getenv("FREESCOUT_API_KEY"),
|
||||
}
|
||||
altemail:str = f"{email.split('@')[0]}@e.hns.au"
|
||||
|
||||
for thread in conversation:
|
||||
for message in thread["messages"]:
|
||||
if email in message["to"]:
|
||||
if email in message["to"] or altemail in message["to"]:
|
||||
requests.delete(
|
||||
f"https://ticket.woodburn.au/api/conversations/{thread['id']}", headers=headers)
|
||||
clear_cache()
|
||||
|
||||
Reference in New Issue
Block a user