diff options
| -rw-r--r-- | port_me/checkdbs.py | 2 | ||||
| -rw-r--r-- | src/mailman/app/moderator.py | 2 | ||||
| -rw-r--r-- | src/mailman/app/subscriptions.py | 4 | ||||
| -rw-r--r-- | src/mailman/app/tests/test_moderation.py | 19 | ||||
| -rw-r--r-- | src/mailman/app/tests/test_subscriptions.py | 13 | ||||
| -rw-r--r-- | src/mailman/chains/hold.py | 2 | ||||
| -rw-r--r-- | src/mailman/chains/tests/test_hold.py | 4 | ||||
| -rw-r--r-- | src/mailman/docs/NEWS.rst | 2 | ||||
| -rw-r--r-- | src/mailman/email/message.py | 2 |
9 files changed, 32 insertions, 18 deletions
diff --git a/port_me/checkdbs.py b/port_me/checkdbs.py index ac6dd2ad0..7f46e97d4 100644 --- a/port_me/checkdbs.py +++ b/port_me/checkdbs.py @@ -199,7 +199,7 @@ def main(): mlist.GetBouncesEmail(), subject, text, mlist.preferred_language) - msg.send(mlist, tomoderators=True) + msg.send(mlist, to_moderators=True) finally: mlist.Unlock() diff --git a/src/mailman/app/moderator.py b/src/mailman/app/moderator.py index c3347c1ff..9d3856f33 100644 --- a/src/mailman/app/moderator.py +++ b/src/mailman/app/moderator.py @@ -204,7 +204,7 @@ def hold_unsubscription(mlist, email): msg = UserNotification( mlist.owner_address, mlist.owner_address, subject, text, mlist.preferred_language) - msg.send(mlist, tomoderators=True) + msg.send(mlist, to_moderators=True) return request_id diff --git a/src/mailman/app/subscriptions.py b/src/mailman/app/subscriptions.py index 9e915a25d..9e8d8dd9d 100644 --- a/src/mailman/app/subscriptions.py +++ b/src/mailman/app/subscriptions.py @@ -286,7 +286,7 @@ class SubscriptionWorkflow(_SubscriptionWorkflowCommon): msg = UserNotification( self.mlist.owner_address, self.mlist.owner_address, subject, text, self.mlist.preferred_language) - msg.send(self.mlist, tomoderators=True) + msg.send(self.mlist, to_moderators=True) # The workflow must stop running here. raise StopIteration @@ -434,7 +434,7 @@ class UnSubscriptionWorkflow(_SubscriptionWorkflowCommon): msg = UserNotification( self.mlist.owner_address, self.mlist.owner_address, subject, text, self.mlist.preferred_language) - msg.send(self.mlist, tomoderators=True) + msg.send(self.mlist, to_moderators=True) # The workflow must stop running here raise StopIteration diff --git a/src/mailman/app/tests/test_moderation.py b/src/mailman/app/tests/test_moderation.py index 45f94f27b..bb3958cd7 100644 --- a/src/mailman/app/tests/test_moderation.py +++ b/src/mailman/app/tests/test_moderation.py @@ -159,22 +159,29 @@ class TestUnsubscription(unittest.TestCase): def test_unsubscribe_defer(self): # When unsubscriptions must be approved by the moderator, but the # moderator defers this decision. - anne = getUtility(IUserManager).create_address( - 'anne@example.org', 'Anne Person') + user_manager = getUtility(IUserManager) + anne = user_manager.create_address('anne@example.org', 'Anne Person') token, token_owner, member = self._manager.register( anne, pre_verified=True, pre_confirmed=True, pre_approved=True) self.assertIsNone(token) self.assertEqual(member.address.email, 'anne@example.org') - mod = self._user_manager.create_user('bart@example.com', 'Bart User') - address = set_preferred(mod) + bart = user_manager.create_user('bart@example.com', 'Bart User') + address = set_preferred(bart) self._mlist.subscribe(address, MemberRole.moderator) # Now hold and handle an unsubscription request. token = hold_unsubscription(self._mlist, 'anne@example.org') handle_unsubscription(self._mlist, token, Action.defer) items = get_queue_messages('virgin', expected_count=2) - moderator_message = items[1] + # Find the moderator message. + for item in items: + if item.msg['to'] == 'test-owner@example.com': + break + else: + raise AssertionError('No moderator email found') + self.assertEqual(item.msgdata['recipients'], {'bart@example.com'}) self.assertEqual( - moderator_message.msgdata['recipients'], {'bart@example.com'}) + item.msg['subject'], + 'New unsubscription request from Test by anne@example.org') def test_bogus_token(self): # Try to handle an unsubscription with a bogus token. diff --git a/src/mailman/app/tests/test_subscriptions.py b/src/mailman/app/tests/test_subscriptions.py index e72da6b01..5d49590ca 100644 --- a/src/mailman/app/tests/test_subscriptions.py +++ b/src/mailman/app/tests/test_subscriptions.py @@ -436,17 +436,22 @@ class TestSubscriptionWorkflow(unittest.TestCase): self._mlist.admin_immed_notify = True self._mlist.subscription_policy = SubscriptionPolicy.moderate anne = self._user_manager.create_address(self._anne) - mod = self._user_manager.create_user('bart@example.com', 'Bart User') - address = set_preferred(mod) + bart = self._user_manager.create_user('bart@example.com', 'Bart User') + address = set_preferred(bart) self._mlist.subscribe(address, MemberRole.moderator) workflow = SubscriptionWorkflow(self._mlist, anne, pre_verified=True, pre_confirmed=True) # Consume the entire state machine. list(workflow) + # Find the moderator message. items = get_queue_messages('virgin', expected_count=1) - messagedata = items[0].msgdata - self.assertEqual(messagedata['recipients'], {'bart@example.com'}) + for item in items: + if item.msg['to'] == 'test-owner@example.com': + break + else: + raise AssertionError('No moderator email found') + self.assertEqual(item.msgdata['recipients'], {'bart@example.com'}) message = items[0].msg self.assertEqual(message['From'], 'test-owner@example.com') self.assertEqual(message['To'], 'test-owner@example.com') diff --git a/src/mailman/chains/hold.py b/src/mailman/chains/hold.py index b8c59358e..f111aee3c 100644 --- a/src/mailman/chains/hold.py +++ b/src/mailman/chains/hold.py @@ -246,7 +246,7 @@ also appear in the first line of the body of the reply.""")), nmsg.attach(text) nmsg.attach(MIMEMessage(msg)) nmsg.attach(MIMEMessage(dmsg)) - nmsg.send(mlist, tomoderators=True) + nmsg.send(mlist, to_moderators=True) # Log the held message. Log messages are not translated, so recast # the reasons in the English. with _.using('en'): diff --git a/src/mailman/chains/tests/test_hold.py b/src/mailman/chains/tests/test_hold.py index 677ce2f0f..13dd1b40e 100644 --- a/src/mailman/chains/tests/test_hold.py +++ b/src/mailman/chains/tests/test_hold.py @@ -135,8 +135,8 @@ A message body. # Issue #144 - UnicodeEncodeError in the hold chain. self._mlist.admin_immed_notify = True self._mlist.respond_to_post_requests = False - mod = self._user_manager.create_user('bart@example.com', 'Bart User') - address = set_preferred(mod) + bart = self._user_manager.create_user('bart@example.com', 'Bart User') + address = set_preferred(bart) self._mlist.subscribe(address, MemberRole.moderator) path = resource_filename('mailman.chains.tests', 'issue144.eml') with open(path, 'rb') as fp: diff --git a/src/mailman/docs/NEWS.rst b/src/mailman/docs/NEWS.rst index f72498a1d..fdde0589f 100644 --- a/src/mailman/docs/NEWS.rst +++ b/src/mailman/docs/NEWS.rst @@ -97,6 +97,8 @@ Bugs (Closes: #283) * Remove the digest mbox files after the digests are sent. Given by Aurélien Bompard. (Closes: #259) + * Messages sent to the list's moderators now include the actual recipient + addresses. Given by Tom Briles. (Closes: #68) Configuration ------------- diff --git a/src/mailman/email/message.py b/src/mailman/email/message.py index 786dc11d0..ebfef9d9b 100644 --- a/src/mailman/email/message.py +++ b/src/mailman/email/message.py @@ -166,7 +166,7 @@ class UserNotification(Message): self.recipients = set( member.address.email for member in mlist.moderators.members - if member.delivery_status == DeliveryStatus.enabled) + if member.delivery_status is DeliveryStatus.enabled) self['To'] = COMMASPACE.join(self.recipients) self._enqueue(mlist, **_kws) |
