Abhilash Raj pushed to branch master at GNU Mailman / Mailman Core
Commits:
b38e75dd by Mark Sapiro at 2019-05-08T15:37:19Z
Treat accept_these_nonmembers hits as Action.defer.
- - - - -
4cdd8990 by Abhilash Raj at 2019-05-08T15:37:20Z
Merge branch 'non_memb' into 'master'
Treat accept_these_nonmembers hits as Action.defer.
Closes #587
See merge request mailman/mailman!511
- - - - -
3 changed files:
- src/mailman/docs/NEWS.rst
- src/mailman/rules/moderation.py
- src/mailman/rules/tests/test_moderation.py
Changes:
=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -24,6 +24,9 @@ Bugs
* ``X-Mailman-Approved-At`` header now has correct timezone. (Closes #584)
* A spurious ``invalid FilterAction: discard. Treating as discard`` log
message is eliminated. (Closes #592)
+* A post from a nonmember matching the legacy ``accept_these_nonmembers`` is
+ now subject to subsequent rules rather than accepted immediately.
+ (Closes #587)
Command line
------------
=====================================
src/mailman/rules/moderation.py
=====================================
@@ -155,6 +155,9 @@ class NonmemberModeration:
for addr in checklist:
if ((addr.startswith('^') and re.match(addr, sender))
or addr == sender): # noqa: W503
+ # accept_these_nonmembers should 'defer'.
+ if action_name == 'accept':
+ return False
with _.defer_translation():
# This will be translated at the point of use.
reason = (
=====================================
src/mailman/rules/tests/test_moderation.py
=====================================
@@ -141,11 +141,15 @@ A message body.
""".format(address))
msgdata = {}
result = rule.check(self._mlist, msg, msgdata)
- self.assertTrue(result, 'NonmemberModeration rule should hit')
- self.assertIn('member_moderation_action', msgdata)
- self.assertEqual(
- msgdata['member_moderation_action'], action_name,
- 'Wrong action for {}: {}'.format(address, action_name))
+ if action_name == 'accept':
+ self.assertFalse(
+ result, 'NonmemberModeration rule should miss')
+ else:
+ self.assertTrue(result, 'NonmemberModeration rule should hit')
+ self.assertIn('member_moderation_action', msgdata)
+ self.assertEqual(
+ msgdata['member_moderation_action'], action_name,
+ 'Wrong action for {}: {}'.format(address, action_name))
def test_nonmember_fallback_to_list_defaults(self):
# https://gitlab.com/mailman/mailman/issues/189
View it on GitLab:
https://gitlab.com/mailman/mailman/compare/a873fc5647977ad573e073a4a5d70dc6d08f3bba...4cdd8990f3efebc93156313b8de9eebebcbf0adb
--
View it on GitLab:
https://gitlab.com/mailman/mailman/compare/a873fc5647977ad573e073a4a5d70dc6d08f3bba...4cdd8990f3efebc93156313b8de9eebebcbf0adb
You're receiving this email because of your account on gitlab.com.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org