Issue 113 - email template system #224
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces an EmailTemplateManager class and a standard for defining future email templates.
Methods
create(): an asynchronous factory method that registers partials before returning a new instance.renderTemplate(): renders a template by a given name followed by the defined standard/convention (see below), returning strings containing a subject line as well as the HTML and plaintext versions of the template.previewTemplate(): returns a string for the email preview text.getTemplateList(): returns a list of the valid template names that can be passed torenderTemplate()andpreviewTemplate()Additional Notes
renderTemplate()andpreviewTemplate()are made generic overEmailTemplateDataMapso that a superset of required parameters to the template are enforced.EmailServiceclass was modified with a factory method to accommodate the integration ofEmailTemplateManager. Changes were made accordingly toauthRoutes.tsTemplate Definition Convention
backend/src/email/templatesare used as the template name inHandlebars.hbsfiles with just the template name represent the HTML version of the email_subject.hbs,_plain.hbs, and_preview.hbssuffixes after the template name correspond to the subject, plaintext, and email preview respectively (ex.welcome_plain.hbs)Templates introduced
welcomemeetingConfirmationupdatepasswordReset