messages: custom content described in customcontent.go, message tests

customcontent.go constains a structure with all the custom content,
methods for getting display names, subjects, etc., and a list of
variables, conditionals, and placeholder values. Tests for constructX
methods included in email_test.go, and all jfa-go tests can be run with
make INTERNAL=off test.
This commit is contained in:
Harvey Tindall
2025-08-30 14:21:26 +01:00
parent 0b43ad4ed5
commit 60dbfa2d1e
27 changed files with 1646 additions and 1141 deletions

View File

@@ -0,0 +1,16 @@
# Quick script to scrape custom content names, variables and conditionals. The decision to generate vars and conds dynamically from the included plaintext emails, then bodge extra variables on top was stupid, and is only done -once- before getting stored in the DB indefinitely, meaning new variables can't easily be added. Output of this will be coalesced into a predefined list included with the software.
import requests, json
content = requests.get("http://localhost:8056/config/emails?lang=en-gb&filter=user").json()
out = {}
for key in content:
resp = requests.get("http://localhost:8056/config/emails/"+key)
out[key] = resp.json()
del out[key]["html"]
del out[key]["plaintext"]
del out[key]["content"]
print(json.dumps(out, indent=4))