Compare commits

..

2 Commits

Author SHA1 Message Date
415806e852 fix: Send notifications from alternative email addresses
All checks were successful
Build Docker / BuildImage (push) Successful in 30s
2024-10-15 10:16:19 +11:00
3b118e6923 fix: Allow deleting emails sent to e.hns.au emails
All checks were successful
Build Docker / BuildImage (push) Successful in 37s
2024-10-09 16:04:31 +11:00

View File

@@ -205,6 +205,9 @@ def save_notification_settings(email, webhook, email_alert):
def get_notification_settings(email): def get_notification_settings(email):
if not os.path.exists(notification_file): if not os.path.exists(notification_file):
return False return False
# Reformat email
email = email.split('@')[0] + '@login.hns.au'
with open(notification_file, "r") as f: with open(notification_file, "r") as f:
data = json.load(f) data = json.load(f)
@@ -228,9 +231,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()