docusealco / docuseal

Open source DocuSign alternative. Create, fill, and sign digital documents ✍️
https://www.docuseal.co
GNU Affero General Public License v3.0
6.23k stars 443 forks source link

Submitter's name attribute is nil after template creation #280

Open krakowski opened 4 months ago

krakowski commented 4 months ago

Description

After creating a document template, the name attribute of the linked Submitter objects remains nil. This results in email templates resolving the {{ submitter.name }} template variable to the recipients e-mail address (fallback value).

https://github.com/docusealco/docuseal/blob/a249b0a6789dd9da3ece23dc05027301bb7e6410/lib/replace_email_variables.rb#L30

Possible Solution

The Submission object contains an attribute named template_submitters, which holds the configured submitter names. The following code snippet returns the name assigned to the submitter on template creation.

submitter.submission.template_submitters.find{ |entry| entry['uuid'] == submitter.uuid }['name']