Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
9b8af392 by Mark Sapiro at 2020-08-29T02:57:04+00:00
Fixed message.UserNotification() to work with recipients including
display names.

- - - - -
b215a851 by Mark Sapiro at 2020-08-29T02:57:04+00:00
Merge branch 'env' into 'master'

Fixed message.UserNotification() to work with recipients including

Closes #757

See merge request mailman/mailman!696
- - - - -


4 changed files:

- src/mailman/app/tests/test_moderation.py
- src/mailman/app/tests/test_notifications.py
- src/mailman/docs/NEWS.rst
- src/mailman/email/message.py


Changes:

=====================================
src/mailman/app/tests/test_moderation.py
=====================================
@@ -125,7 +125,7 @@ Message-ID: <alpha>
         items = get_queue_messages('virgin', expected_count=1)
         self.assertEqual(str(items[0].msg['subject']),
                          'Forward of moderated message')
-        self.assertEqual(items[0].msgdata['recipients'],
+        self.assertEqual(list(items[0].msgdata['recipients']),
                          ['z...@example.com'])
 
     def test_survive_a_deleted_message(self):


=====================================
src/mailman/app/tests/test_notifications.py
=====================================
@@ -264,6 +264,17 @@ have any other questions, you may contact
         message = items[0].msg
         self.assertEqual(message['to'], 'Anne Person <a...@example.com>')
 
+    def test_member_susbcribed_address_has_display_name_not_msgdata(self):
+        address = getUtility(IUserManager).create_address(
+            'a...@example.com', 'Anne Person')
+        address.verified_on = now()
+        self._mlist.subscribe(address)
+        items = get_queue_messages('virgin', expected_count=1)
+        message = items[0].msg
+        msgdata = items[0].msgdata
+        self.assertEqual(message['to'], 'Anne Person <a...@example.com>')
+        self.assertEqual(list(msgdata['recipients']), ['a...@example.com'])
+
     def test_member_subscribed_address_has_no_display_name(self):
         address = getUtility(IUserManager).create_address('a...@example.com')
         address.verified_on = now()


=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -38,6 +38,8 @@ Bugs
 * Removed unnecessary call to ``Lock().disown()`` from ``bin/master.py``.
   (Closes #754)
 * Fixed an invalid logging call in bin/master.py.  (Closes #756)
+* VERPed list welcome messages now have a correct envelope sender.
+  (Closes #757)
 
 Command line
 ------------


=====================================
src/mailman/email/message.py
=====================================
@@ -144,10 +144,11 @@ class UserNotification(Message):
         self['From'] = sender
         if isinstance(recipients, (list, set, tuple)):
             self['To'] = COMMASPACE.join(recipients)
-            self.recipients = recipients
+            self.recipients = {email.utils.parseaddr(recipient)[1] for
+                               recipient in recipients}
         else:
             self['To'] = recipients
-            self.recipients = set([recipients])
+            self.recipients = set([email.utils.parseaddr(recipients)[1]])
 
     def send(self, mlist, *, add_precedence=True, **_kws):
         """Sends the message by enqueuing it to the 'virgin' queue.



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/dbdb4d61edc500000ecd0074bbc08d1d02af4210...b215a85185ba54a01b77757c868ca8c855273274

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/dbdb4d61edc500000ecd0074bbc08d1d02af4210...b215a85185ba54a01b77757c868ca8c855273274
You're receiving this email because of your account on gitlab.com.


_______________________________________________
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org

Reply via email to