aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/MailList.py
diff options
context:
space:
mode:
Diffstat (limited to 'Mailman/MailList.py')
-rw-r--r--Mailman/MailList.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/Mailman/MailList.py b/Mailman/MailList.py
index 9e6bbcb6..fdd47ae1 100644
--- a/Mailman/MailList.py
+++ b/Mailman/MailList.py
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2018 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2020 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -833,8 +833,8 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
#
# Membership management front-ends and assertion checks
#
- def CheckPending(self, email):
- """Check if there is already an unexpired pending subscription for
+ def CheckPending(self, email, unsub=False):
+ """Check if there is already an unexpired pending (un)subscription for
this email.
"""
if not mm_cfg.REFUSE_SECOND_PENDING:
@@ -846,9 +846,11 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
for k, v in pends.items():
if k in ('evictions', 'version'):
continue
- op, data = v
- if (op == Pending.SUBSCRIPTION and
- data.address.lower() == email.lower()):
+ op, data = v[:2]
+ if (op == Pending.SUBSCRIPTION and not unsub and
+ data.address.lower() == email.lower() or
+ op == Pending.UNSUBSCRIPTION and unsub and
+ data.lower() == email.lower()):
return True
return False
@@ -1477,6 +1479,8 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
assert 0, 'Bad op: %s' % op
def ConfirmUnsubscription(self, addr, lang=None, remote=None):
+ if self.CheckPending(addr, unsub=True):
+ raise Errors.MMAlreadyPending, email
if lang is None:
lang = self.getMemberLanguage(addr)
cookie = self.pend_new(Pending.UNSUBSCRIPTION, addr)