summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Sapiro2016-12-30 11:36:54 -0800
committerMark Sapiro2016-12-30 11:36:54 -0800
commiteba4d0767aa141dc631e433ac01a86302da233b5 (patch)
tree6ac31b88c9535946391abb09177503649c7793de /src
parent2ead4c9f0f70ac3ebd06105562579f74fa6963f1 (diff)
parent615415cb45a8a7d8b26c744940b2e57ca72c1249 (diff)
downloadmailman-eba4d0767aa141dc631e433ac01a86302da233b5.tar.gz
mailman-eba4d0767aa141dc631e433ac01a86302da233b5.tar.zst
mailman-eba4d0767aa141dc631e433ac01a86302da233b5.zip
Diffstat (limited to 'src')
-rw-r--r--src/mailman/app/moderator.py2
-rw-r--r--src/mailman/app/subscriptions.py4
-rw-r--r--src/mailman/app/tests/test_moderation.py3
-rw-r--r--src/mailman/app/tests/test_subscriptions.py3
-rw-r--r--src/mailman/chains/hold.py2
-rw-r--r--src/mailman/chains/tests/test_hold.py4
-rw-r--r--src/mailman/database/types.py6
-rw-r--r--src/mailman/docs/NEWS.rst2
-rw-r--r--src/mailman/email/message.py12
9 files changed, 14 insertions, 24 deletions
diff --git a/src/mailman/app/moderator.py b/src/mailman/app/moderator.py
index fe7a81383..deb54e9b5 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, to_moderators=True)
+ msg.send(mlist)
return request_id
diff --git a/src/mailman/app/subscriptions.py b/src/mailman/app/subscriptions.py
index a38b3061d..7d02a4e6c 100644
--- a/src/mailman/app/subscriptions.py
+++ b/src/mailman/app/subscriptions.py
@@ -287,7 +287,7 @@ class SubscriptionWorkflow(_SubscriptionWorkflowCommon):
msg = UserNotification(
self.mlist.owner_address, self.mlist.owner_address,
subject, text, self.mlist.preferred_language)
- msg.send(self.mlist, to_moderators=True)
+ msg.send(self.mlist)
# The workflow must stop running here.
raise StopIteration
@@ -435,7 +435,7 @@ class UnSubscriptionWorkflow(_SubscriptionWorkflowCommon):
msg = UserNotification(
self.mlist.owner_address, self.mlist.owner_address,
subject, text, self.mlist.preferred_language)
- msg.send(self.mlist, to_moderators=True)
+ msg.send(self.mlist)
# 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 bb3958cd7..90377bf72 100644
--- a/src/mailman/app/tests/test_moderation.py
+++ b/src/mailman/app/tests/test_moderation.py
@@ -178,7 +178,8 @@ class TestUnsubscription(unittest.TestCase):
break
else:
raise AssertionError('No moderator email found')
- self.assertEqual(item.msgdata['recipients'], {'bart@example.com'})
+ self.assertEqual(
+ item.msgdata['recipients'], {'test-owner@example.com'})
self.assertEqual(
item.msg['subject'],
'New unsubscription request from Test by anne@example.org')
diff --git a/src/mailman/app/tests/test_subscriptions.py b/src/mailman/app/tests/test_subscriptions.py
index b960b7904..0f4809fd5 100644
--- a/src/mailman/app/tests/test_subscriptions.py
+++ b/src/mailman/app/tests/test_subscriptions.py
@@ -451,7 +451,8 @@ class TestSubscriptionWorkflow(unittest.TestCase):
break
else:
raise AssertionError('No moderator email found')
- self.assertEqual(item.msgdata['recipients'], {'bart@example.com'})
+ self.assertEqual(
+ item.msgdata['recipients'], {'test-owner@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 0b50964b7..86761c3e1 100644
--- a/src/mailman/chains/hold.py
+++ b/src/mailman/chains/hold.py
@@ -247,7 +247,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, to_moderators=True)
+ nmsg.send(mlist)
# 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 6686c4777..02ca08932 100644
--- a/src/mailman/chains/tests/test_hold.py
+++ b/src/mailman/chains/tests/test_hold.py
@@ -173,8 +173,8 @@ A message body.
# delivery to the moderators.
items = get_queue_messages('virgin', expected_count=1)
msgdata = items[0].msgdata
- # Should get sent to moderators.
- self.assertEqual(msgdata['recipients'], {'bart@example.com'})
+ # Should get sent to -owner address.
+ self.assertEqual(msgdata['recipients'], {'test-owner@example.com'})
# Ensure that the subject looks correct in the postauth.txt.
msg = items[0].msg
value = None
diff --git a/src/mailman/database/types.py b/src/mailman/database/types.py
index 10b826e7c..b5fa0626f 100644
--- a/src/mailman/database/types.py
+++ b/src/mailman/database/types.py
@@ -97,7 +97,7 @@ class SAUnicode(TypeDecorator):
@compiles(SAUnicode)
def default_sa_unicode(element, compiler, **kw):
- return compiler.visit_Unicode(element, **kw)
+ return compiler.visit_unicode(element, **kw)
@compiles(SAUnicode, 'mysql')
@@ -121,6 +121,6 @@ def compile_sa_unicode_large(element, compiler, **kw):
return 'VARCHAR(510) COLLATE utf8_bin'
-@compiles(SAUnicode)
-def defalt_sa_unicode_large(element, compiler, **kw):
+@compiles(SAUnicodeLarge)
+def default_sa_unicode_large(element, compiler, **kw):
return compiler.visit_unicode(element, **kw)
diff --git a/src/mailman/docs/NEWS.rst b/src/mailman/docs/NEWS.rst
index 1841f8fb7..093c9bd0e 100644
--- a/src/mailman/docs/NEWS.rst
+++ b/src/mailman/docs/NEWS.rst
@@ -97,8 +97,6 @@ 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)
* Transmit the moderation reason and expose it in the REST API as the
``reason`` attribute. Given by Aurélien Bompard.
* Don't return a 500 error from the REST API when trying to handle a held
diff --git a/src/mailman/email/message.py b/src/mailman/email/message.py
index da2ce837f..da341d1b7 100644
--- a/src/mailman/email/message.py
+++ b/src/mailman/email/message.py
@@ -30,7 +30,6 @@ import email.utils
from email.header import Header
from email.mime.multipart import MIMEMultipart
from mailman.config import config
-from mailman.interfaces.member import DeliveryStatus
from public import public
@@ -133,7 +132,7 @@ class UserNotification(Message):
self['To'] = recipients
self.recipients = set([recipients])
- def send(self, mlist, *, add_precedence=True, to_moderators=False, **_kws):
+ def send(self, mlist, *, add_precedence=True, **_kws):
"""Sends the message by enqueuing it to the 'virgin' queue.
This is used for all internally crafted messages.
@@ -143,9 +142,6 @@ class UserNotification(Message):
:param add_precedence: Flag indicating whether a `Precedence: bulk`
header should be added to the message or not.
:type add_precedence: bool
- :param to_moderators: Flag indicating whether the message should be
- sent to the list's moderators instead of the list's membership.
- :type to_moderators: bool
This function also accepts arbitrary keyword arguments. The key/value
pairs for **kws is added to the metadata dictionary associated with
@@ -163,12 +159,6 @@ class UserNotification(Message):
# don't override an existing Precedence: header.
if 'precedence' not in self and add_precedence:
self['Precedence'] = 'bulk'
- if to_moderators:
- self.recipients = set(
- member.address.email
- for member in mlist.moderators.members
- if member.delivery_status is DeliveryStatus.enabled)
- self['To'] = COMMASPACE.join(self.recipients)
self._enqueue(mlist, **_kws)
def _enqueue(self, mlist, **_kws):