Skip to content

Commit

Permalink
Fix subject templating
Browse files Browse the repository at this point in the history
  • Loading branch information
folix-01 committed Jul 4, 2024
1 parent bca7ff4 commit 276d370
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,19 @@ def get_subject(self):
)

for i in self.form_data.get("data", []):
# Handle `field_name_321323` kind of id used by frontend package
field_id = i.get("field_id", "").split("_")[-1]

field_id = i.get("field_id")

if not field_id:
continue

subject = subject.replace("${" + i.get("field_id") + "}", i.get("value"))
# Handle this kind of id format: `field_name_123321, whichj is used by frontend package logics
pattern = r"\$\{[^}]+\}"
matches = re.findall(pattern, subject)

for match in matches:
if field_id in match:
subject = subject.replace(match, i.get("value"))

return subject

Expand Down

0 comments on commit 276d370

Please sign in to comment.