Guénaël Muller 7 years ago
parent
commit
8cf57205a9
1 changed files with 9 additions and 0 deletions
  1. 9 0
      tracim/tracim/lib/notifications.py

+ 9 - 0
tracim/tracim/lib/notifications.py View File

271
         for role in notifiable_roles:
271
         for role in notifiable_roles:
272
             logger.info(self, 'Sending email to {}'.format(role.user.email))
272
             logger.info(self, 'Sending email to {}'.format(role.user.email))
273
             to_addr = '{name} <{email}>'.format(name=role.user.display_name, email=role.user.email)
273
             to_addr = '{name} <{email}>'.format(name=role.user.display_name, email=role.user.email)
274
+            #
275
+            # INFO - G.M - 2017-11-15 - set content_id in header to permit reply
276
+            # references can have multiple values, but only one in this case.
274
             replyto_addr = self._global_config.EMAIL_NOTIFICATION_REPLY_TO_EMAIL.replace( # nopep8
277
             replyto_addr = self._global_config.EMAIL_NOTIFICATION_REPLY_TO_EMAIL.replace( # nopep8
275
                 '{content_id}',str(content.content_id)
278
                 '{content_id}',str(content.content_id)
276
             )
279
             )
280
+
277
             reference_addr = self._global_config.EMAIL_NOTIFICATION_REFERENCES_EMAIL.replace( #nopep8
281
             reference_addr = self._global_config.EMAIL_NOTIFICATION_REFERENCES_EMAIL.replace( #nopep8
278
                 '{content_id}',str(content.content_id)
282
                 '{content_id}',str(content.content_id)
279
              )
283
              )
294
             message['From'] = self._get_sender(user)
298
             message['From'] = self._get_sender(user)
295
             message['To'] = to_addr
299
             message['To'] = to_addr
296
             message['Reply-to'] = formataddr(('',replyto_addr))
300
             message['Reply-to'] = formataddr(('',replyto_addr))
301
+            # INFO - G.M - 2017-11-15
302
+            # References can theorically have label, but in pratice, references
303
+            # contains only message_id from parents post in thread.
304
+            # To link this email to a content we create a virtual parent
305
+            # in reference who contain the content_id.
297
             message['References'] = formataddr(('',reference_addr))
306
             message['References'] = formataddr(('',reference_addr))
298
             # TODO: add correct header to allow reply
307
             # TODO: add correct header to allow reply
299
             body_text = self._build_email_body(self._global_config.EMAIL_NOTIFICATION_CONTENT_UPDATE_TEMPLATE_TEXT, role, content, user)
308
             body_text = self._build_email_body(self._global_config.EMAIL_NOTIFICATION_CONTENT_UPDATE_TEMPLATE_TEXT, role, content, user)