summary refs log tree commit diff
path: root/synapse/push
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2016-06-02 15:33:28 +0100
committerDavid Baker <dave@matrix.org>2016-06-02 15:33:28 +0100
commit812b5de0feeb905643faf4decff3d7b566d3dbe9 (patch)
tree70c5d4a2dab2e35bc39711392cba52e22e5a145f /synapse/push
parentMerge branch 'dbkr/split_out_auth_handler' into dbkr/email_unsubscribe (diff)
parentFix setting the _clock in SQLBaseStore (diff)
downloadsynapse-812b5de0feeb905643faf4decff3d7b566d3dbe9.tar.xz
Merge remote-tracking branch 'origin/develop' into dbkr/email_unsubscribe
Diffstat (limited to 'synapse/push')
-rw-r--r--synapse/push/emailpusher.py10
-rw-r--r--synapse/push/mailer.py4
2 files changed, 10 insertions, 4 deletions
diff --git a/synapse/push/emailpusher.py b/synapse/push/emailpusher.py
index 46d7c0434b..12a3ec7fd8 100644
--- a/synapse/push/emailpusher.py
+++ b/synapse/push/emailpusher.py
@@ -44,7 +44,8 @@ THROTTLE_RESET_AFTER_MS = (12 * 60 * 60 * 1000)
 
 # does each email include all unread notifs, or just the ones which have happened
 # since the last mail?
-INCLUDE_ALL_UNREAD_NOTIFS = True
+# XXX: this is currently broken as it includes ones from parted rooms(!)
+INCLUDE_ALL_UNREAD_NOTIFS = False
 
 
 class EmailPusher(object):
@@ -72,7 +73,12 @@ class EmailPusher(object):
         self.processing = False
 
         if self.hs.config.email_enable_notifs:
-            self.mailer = Mailer(self.hs)
+            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
 
diff --git a/synapse/push/mailer.py b/synapse/push/mailer.py
index b96cab5ef8..b172aca1d2 100644
--- a/synapse/push/mailer.py
+++ b/synapse/push/mailer.py
@@ -78,13 +78,13 @@ ALLOWED_ATTRS = {
 
 
 class Mailer(object):
-    def __init__(self, hs):
+    def __init__(self, hs, app_name):
         self.hs = hs
         self.store = self.hs.get_datastore()
         self.handlers = self.hs.get_handlers()
         self.state_handler = self.hs.get_state_handler()
         loader = jinja2.FileSystemLoader(self.hs.config.email_template_dir)
-        self.app_name = self.hs.config.email_app_name
+        self.app_name = app_name
         env = jinja2.Environment(loader=loader)
         env.filters["format_ts"] = format_ts_filter
         env.filters["mxc_to_http"] = self.mxc_to_http_filter