summary refs log tree commit diff
path: root/synapse/push/emailpusher.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-05-23 09:34:08 +0100
committerGitHub <noreply@github.com>2017-05-23 09:34:08 +0100
commit58c472029311e98e4afbe125a00566c8a49574ee (patch)
tree1b6d83e450732d91a3a2207354f0c3828669194f /synapse/push/emailpusher.py
parentMerge pull request #2241 from matrix-org/erikj/fix_notifs (diff)
parentOnly load jinja2 templates once (diff)
downloadsynapse-58c472029311e98e4afbe125a00566c8a49574ee.tar.xz
Merge pull request #2242 from matrix-org/erikj/email_refactor
Only load jinja2 templates once
Diffstat (limited to 'synapse/push/emailpusher.py')
-rw-r--r--synapse/push/emailpusher.py15
1 files changed, 3 insertions, 12 deletions
diff --git a/synapse/push/emailpusher.py b/synapse/push/emailpusher.py

index c7afd11111..a69dda7b09 100644 --- a/synapse/push/emailpusher.py +++ b/synapse/push/emailpusher.py
@@ -21,7 +21,6 @@ import logging from synapse.util.metrics import Measure from synapse.util.logcontext import LoggingContext -from mailer import Mailer logger = logging.getLogger(__name__) @@ -56,8 +55,10 @@ class EmailPusher(object): This shares quite a bit of code with httpusher: it would be good to factor out the common parts """ - def __init__(self, hs, pusherdict): + def __init__(self, hs, pusherdict, mailer): self.hs = hs + self.mailer = mailer + self.store = self.hs.get_datastore() self.clock = self.hs.get_clock() self.pusher_id = pusherdict['id'] @@ -73,16 +74,6 @@ class EmailPusher(object): self.processing = False - if self.hs.config.email_enable_notifs: - if 'data' in pusherdict and 'brand' in pusherdict['data']: - app_name = pusherdict['data']['brand'] - else: - app_name = self.hs.config.email_app_name - - self.mailer = Mailer(self.hs, app_name) - else: - self.mailer = None - @defer.inlineCallbacks def on_started(self): if self.mailer is not None: