Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits:
c6b21fd7 by Mark Sapiro at 2022-11-03T16:28:56+00:00
The change in !997 was incorrect. It would not allow subscribing any of a
user's addresses to a list if the `user` was subscribed. The proper change
is to not allow subscribing of a user's preferred address if the `user` is
subscribed. This corrects that. It also adds a regression test to insure that
subscribing a user's 'other' address succeeds.
- - - - -
e1921fe1 by Mark Sapiro at 2022-11-03T16:28:57+00:00
Merge branch 'subs' into 'master'
Fix test in !997.
See merge request mailman/mailman!1051
- - - - -
3 changed files:
- src/mailman/app/subscriptions.py
- src/mailman/app/tests/test_subscriptions.py
- src/mailman/docs/NEWS.rst
Changes:
=====================================
src/mailman/app/subscriptions.py
=====================================
@@ -237,7 +237,7 @@ class SubscriptionWorkflow(_SubscriptionWorkflowCommon):
assert self.user is not None and self.address is not None, (
'Insane sanity check results')
# Is this subscriber already a member?
- if ((self.user.preferred_address is not None and
+ if ((self.user.preferred_address == self.address and
self.mlist.is_subscribed(self.user)) or
self.mlist.is_subscribed(self.address)):
raise AlreadySubscribedError(
=====================================
src/mailman/app/tests/test_subscriptions.py
=====================================
@@ -961,3 +961,27 @@ approval:
items = get_queue_messages('virgin', expected_count=1)
self.assertEqual(str(items[0].msg['Subject']), "Vous avez"
" été désabonné de la liste de diffusion Test")
+
+ def test_mutltiple_subscriptions_for_one_user(self):
+ anne = self._user_manager.create_user(self._anne)
+ set_preferred(anne)
+ email_2 = self._user_manager.create_address('[email protected]')
+ anne.link(email_2)
+ # Subscribe the user first.
+ workflow = SubscriptionWorkflow(
+ self._mlist, anne,
+ pre_verified=True, pre_confirmed=True, pre_approved=True
+ )
+ list(workflow)
+ # Assert the user was subscribed.
+ member = self._mlist.regular_members.get_member(self._anne)
+ self.assertIsNotNone(member)
+ # Now, try to subscribe the 2nd address of the same user.
+ workflow = SubscriptionWorkflow(
+ self._mlist, email_2,
+ pre_verified=True, pre_confirmed=True, pre_approved=True
+ )
+ list(workflow)
+ # And assert it succeeded.
+ member = self._mlist.regular_members.get_member(email_2.email)
+ self.assertIsNotNone(member)
=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -13,6 +13,12 @@ Here is a history of user visible changes to Mailman.
3.3.7
=====
+(2022-xx-xx)
+
+Bugs fixed
+----------
+* The fix for #994 in 3.3.6 blocked too many subscription attempts. This is
+ now corrected and another test added.
.. _news-3.3.6:
View it on GitLab:
https://gitlab.com/mailman/mailman/-/compare/06a3e08304efbc9e3fe49fa3a9a6fa747be8f43b...e1921fe1783a3de13ac282f63aefb6ce584efacf
--
View it on GitLab:
https://gitlab.com/mailman/mailman/-/compare/06a3e08304efbc9e3fe49fa3a9a6fa747be8f43b...e1921fe1783a3de13ac282f63aefb6ce584efacf
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]