Przeglądaj źródła

Closes #157: Send notifications email with personalized address

Bastien Sevajol (Algoo) 7 lat temu
rodzic
commit
d5407fea8a
1 zmienionych plików z 13 dodań i 3 usunięć
  1. 13 3
      tracim/tracim/lib/notifications.py

+ 13 - 3
tracim/tracim/lib/notifications.py Wyświetl plik

@@ -195,10 +195,20 @@ class EmailNotifier(object):
195 195
                 self._global_config.EMAIL_NOTIFICATION_FROM_EMAIL,
196 196
             )
197 197
 
198
-        return '{0} ({1}) <{2}>'.format(
198
+        # We add a suffix to email to prevent client like Thunderbird to
199
+        # display personal adressbook label.
200
+        email = self._global_config.EMAIL_NOTIFICATION_FROM_EMAIL
201
+        email_name, domain = email.split('@')
202
+        arranged_email = '{0}+{1}@{2}'.format(
203
+            email_name,
204
+            str(user.user_id),
205
+            domain,
206
+        )
207
+
208
+        return '{0} {1} <{2}>'.format(
199 209
             user.display_name,
200
-            _('via Tracim'),
201
-            self._global_config.EMAIL_NOTIFICATION_FROM_EMAIL,
210
+            'via Tracim',
211
+            arranged_email,
202 212
         )
203 213
 
204 214
     def notify_content_update(self, event_actor_id: int, event_content_id: int):