Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits: bca31644 by Mark Sapiro at 2021-08-30T17:08:26+00:00 Bypass nonmember moderation for posts from usenet. - - - - - 66a852fe by Mark Sapiro at 2021-08-30T17:08:26+00:00 Merge branch 'usenet' into 'master' Bypass nonmember moderation for posts from usenet. See merge request mailman/mailman!911 - - - - - 4 changed files: - setup.py - src/mailman/docs/NEWS.rst - src/mailman/rules/moderation.py - src/mailman/rules/tests/test_moderation.py Changes: ===================================== setup.py ===================================== @@ -111,7 +111,7 @@ case second 'm'. Any other spelling is incorrect.""", }, install_requires = [ 'aiosmtpd>=1.4.1', - 'alembic>=1.6.2', + 'alembic>=1.6.2,<1.7', 'atpublic', 'authheaders>=0.9.2', 'authres>=1.0.1', ===================================== src/mailman/docs/NEWS.rst ===================================== @@ -103,7 +103,7 @@ Bugs * The ``gatenews`` command now parses messages with email.message_from_bytes without specifying policy. (Closes #934) * Improve error message from REST API for invalid email address (Fixes #872) - +* Nonmember posts gated from usenet bypass nonmember moderation. (Closes #937) Command line ------------ ===================================== src/mailman/rules/moderation.py ===================================== @@ -140,6 +140,9 @@ class NonmemberModeration: # This might be a list posting address in Reply-To: or # some other invalid address. In any case, ignore it. mlist.subscribe(address, MemberRole.nonmember) + # If this message is gated from usenet the rule misses. + if msgdata.get('fromusenet', False): + return False # Check to see if any of the sender emails is already a member. If # so, then this rule misses. member = _find_sender_member(mlist, msg) ===================================== src/mailman/rules/tests/test_moderation.py ===================================== @@ -352,3 +352,21 @@ A message body. """) result = rule.check(self._mlist, msg, {}) self.assertFalse(result) + + def test_nonmember_fromusenet(self): + # Test a post from usenet from a nonmember is not held. + rule = moderation.NonmemberModeration() + user_manager = getUtility(IUserManager) + anne = user_manager.create_address('anne.per...@example.com') + self._mlist.subscribe(anne, MemberRole.nonmember) + msg = mfs("""\ +From: anne.per...@example.com +To: t...@example.com +Subject: A test message +Message-ID: <ant> +MIME-Version: 1.0 + +A message body. +""") + result = rule.check(self._mlist, msg, {'fromusenet': True}) + self.assertFalse(result) View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/bdb8203530ea47ada32703b9994d6d83821cbacf...66a852fe496289f781c6251827f9cd12f75d3928 -- View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/bdb8203530ea47ada32703b9994d6d83821cbacf...66a852fe496289f781c6251827f9cd12f75d3928 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