This commit is contained in:
parent
a70a201222
commit
66e5f3bf70
@ -45,6 +45,13 @@ def load_custom_templates(db: Session) -> Dict[str, Dict[str, Any]]:
|
|||||||
templates = db.query(WhatsAppTemplate).all()
|
templates = db.query(WhatsAppTemplate).all()
|
||||||
result = {}
|
result = {}
|
||||||
for t in templates:
|
for t in templates:
|
||||||
|
# Determine button_param_key:
|
||||||
|
# - If button_url contains {{1}}, default to "event_id"
|
||||||
|
# - Otherwise leave empty (static URL buttons don't need params)
|
||||||
|
button_param_key = ""
|
||||||
|
if t.button_url and "{{1}}" in t.button_url:
|
||||||
|
button_param_key = "event_id"
|
||||||
|
|
||||||
result[t.template_key] = {
|
result[t.template_key] = {
|
||||||
"meta_name": t.meta_name,
|
"meta_name": t.meta_name,
|
||||||
"language_code": t.language_code,
|
"language_code": t.language_code,
|
||||||
@ -59,7 +66,7 @@ def load_custom_templates(db: Session) -> Dict[str, Dict[str, Any]]:
|
|||||||
"button_type": t.button_type,
|
"button_type": t.button_type,
|
||||||
"button_text": t.button_text,
|
"button_text": t.button_text,
|
||||||
"button_url": t.button_url,
|
"button_url": t.button_url,
|
||||||
"button_param_key": t.button_url, # backward compat
|
"button_param_key": button_param_key, # Derived from URL pattern
|
||||||
"fallbacks": json.loads(t.fallbacks),
|
"fallbacks": json.loads(t.fallbacks),
|
||||||
"guest_name_key": "",
|
"guest_name_key": "",
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user