diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2019-04-10 17:58:47 +0100 |
---|---|---|
committer | Brendan Abolivier <babolivier@matrix.org> | 2019-04-17 14:42:20 +0100 |
commit | 20f0617e87924c929f0db0c06d30de0c8d15081c (patch) | |
tree | 813206ef9ad64726925d976d74dbcf6afa8167c3 /synapse/push | |
parent | Add account expiration feature (diff) | |
download | synapse-20f0617e87924c929f0db0c06d30de0c8d15081c.tar.xz |
Send out emails with links to extend an account's validity period
Diffstat (limited to 'synapse/push')
-rw-r--r-- | synapse/push/mailer.py | 14 | ||||
-rw-r--r-- | synapse/push/pusher.py | 6 |
2 files changed, 10 insertions, 10 deletions
diff --git a/synapse/push/mailer.py b/synapse/push/mailer.py index 1eb5be0957..c269bcf4a4 100644 --- a/synapse/push/mailer.py +++ b/synapse/push/mailer.py @@ -521,11 +521,11 @@ def format_ts_filter(value, format): return time.strftime(format, time.localtime(value / 1000)) -def load_jinja2_templates(config): +def load_jinja2_templates(config, template_html_name, template_text_name): """Load the jinja2 email templates from disk Returns: - (notif_template_html, notif_template_text) + (template_html, template_text) """ logger.info("loading email templates from '%s'", config.email_template_dir) loader = jinja2.FileSystemLoader(config.email_template_dir) @@ -533,14 +533,10 @@ def load_jinja2_templates(config): env.filters["format_ts"] = format_ts_filter env.filters["mxc_to_http"] = _create_mxc_to_http_filter(config) - notif_template_html = env.get_template( - config.email_notif_template_html - ) - notif_template_text = env.get_template( - config.email_notif_template_text - ) + template_html = env.get_template(template_html_name) + template_text = env.get_template(template_text_name) - return notif_template_html, notif_template_text + return template_html, template_text def _create_mxc_to_http_filter(config): diff --git a/synapse/push/pusher.py b/synapse/push/pusher.py index b33f2a357b..14bc7823cf 100644 --- a/synapse/push/pusher.py +++ b/synapse/push/pusher.py @@ -44,7 +44,11 @@ class PusherFactory(object): if hs.config.email_enable_notifs: self.mailers = {} # app_name -> Mailer - templates = load_jinja2_templates(hs.config) + templates = load_jinja2_templates( + config=hs.config, + template_html_name=hs.config.email_notif_template_html, + template_text_name=hs.config.email_notif_template_text, + ) self.notif_template_html, self.notif_template_text = templates self.pusher_types["email"] = self._create_email_pusher |