changeset 6763:c25392980f91 stable

email: add X-Kallithea-Notification-Type header To simplify email filtering, add a header indicating the type of email being sent. The 'type_' value corresponds to one of the types defined in class Notification in kallithea/model/db.py, e.g. 'cs_comment', 'pull_request', 'pull_request_comment', ...
author Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
date Tue, 11 Oct 2016 17:45:40 +0200
parents 716e53c085ff
children ea9342f8d46b
files kallithea/model/notification.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/model/notification.py	Tue Sep 06 00:51:18 2016 +0200
+++ b/kallithea/model/notification.py	Tue Oct 11 17:45:40 2016 +0200
@@ -114,9 +114,10 @@
         #don't send email to person who created this comment
         rec_objs = set(recipients_objs).difference(set([created_by_obj]))
 
-        headers = None
+        headers = {}
+        headers['X-Kallithea-Notification-Type'] = type_
         if 'threading' in email_kwargs:
-            headers = {'References': ' '.join('<%s>' % x for x in email_kwargs['threading'])}
+            headers['References'] = ' '.join('<%s>' % x for x in email_kwargs['threading'])
 
         # send email with notification to all other participants
         for rec in rec_objs: