Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits:
e52a1514 by Mark Sapiro at 2022-10-22T23:37:04+00:00
Catch AlreadySubscribedError in email confirm command.
Fixes #1035
- - - - -
ca7451dd by Mark Sapiro at 2022-10-22T23:37:04+00:00
Merge branch 'esub' into 'master'
Catch AlreadySubscribedError in email confirm command.
Closes #1035
See merge request mailman/mailman!1045
- - - - -
3 changed files:
- src/mailman/commands/eml_confirm.py
- src/mailman/commands/tests/test_eml_confirm.py
- src/mailman/docs/NEWS.rst
Changes:
=====================================
src/mailman/commands/eml_confirm.py
=====================================
@@ -21,7 +21,10 @@ from mailman.app.moderator import handle_message
from mailman.core.i18n import _
from mailman.interfaces.action import Action
from mailman.interfaces.command import ContinueProcessing, IEmailCommand
-from mailman.interfaces.member import MembershipIsBannedError
+from mailman.interfaces.member import (
+ AlreadySubscribedError,
+ MembershipIsBannedError,
+)
from mailman.interfaces.pending import IPendings
from mailman.interfaces.subscriptions import ISubscriptionManager, TokenOwner
from mailman.rules.approved import Approved
@@ -85,7 +88,7 @@ class Confirm:
except LookupError:
# The token must not exist in the database.
succeeded = False
- except MembershipIsBannedError as e:
+ except (MembershipIsBannedError, AlreadySubscribedError) as e:
print(str(e), file=results)
return ContinueProcessing.no
if succeeded:
=====================================
src/mailman/commands/tests/test_eml_confirm.py
=====================================
@@ -51,6 +51,7 @@ class TestConfirmJoin(unittest.TestCase):
self._mlist = create_list('[email protected]')
anne = getUtility(IUserManager).create_address(
'[email protected]', 'Anne Person')
+ self._address = anne
self._token, token_owner, member = ISubscriptionManager(
self._mlist).register(anne)
self._command = Confirm()
@@ -103,6 +104,19 @@ class TestConfirmJoin(unittest.TestCase):
self.assertIn('[email protected] is not allowed to subscribe to '
'[email protected]', str(result))
+ def test_confirm_already_member(self):
+ # Confirmation of an already subscribed address should return an
+ # appropriate error.
+ # Subscribe anne.
+ self._mlist.subscribe(self._address)
+ result = Results()
+ status = self._command.process(
+ self._mlist, Message(), {}, (self._token,), result)
+ self.assertEqual(status, ContinueProcessing.no)
+ # The result will contain an error message.
+ self.assertIn('[email protected] is already a MemberRole.member of '
+ 'mailing list [email protected]', str(result))
+
class TestConfirmLeave(unittest.TestCase):
"""Test the `confirm` command when leaving a mailing list."""
=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -81,6 +81,8 @@ Bugs fixed
(Closes #1032)
* An ``AttributeError`` thrown in the task runner, possibly due to a race
condition, is now avoided. (Closes #1028)
+* Email confirmation of a subscription request for a member is no longer
+ shunted. (Closes #1035)
REST
----
View it on GitLab:
https://gitlab.com/mailman/mailman/-/compare/638f08eca1a539aa75672d1c33c6e6b506302c60...ca7451dd105719a123659d6ecc7b95e377ccd5b5
--
View it on GitLab:
https://gitlab.com/mailman/mailman/-/compare/638f08eca1a539aa75672d1c33c6e6b506302c60...ca7451dd105719a123659d6ecc7b95e377ccd5b5
You're receiving this email because of your account on gitlab.com.
_______________________________________________
Mailman-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: [email protected]