aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/MailList.py
diff options
context:
space:
mode:
authorYasuhito FUTATSUKI <futatuki@poem.co.jp>2020-06-01 15:50:14 +0900
committerYasuhito FUTATSUKI <futatuki@poem.co.jp>2020-06-01 15:50:14 +0900
commit6a23f43f94e1cbfbbd413d83f713584815938178 (patch)
treef0f2fb5fcb4fbb121915eddb949f7536bc22d037 /Mailman/MailList.py
parente2bfc83935b64208b56194d82d04c61c25f8406d (diff)
parentbc7fdf4c5fb688ae62e48e614bc285bdcd805ffc (diff)
downloadmailman2-6a23f43f94e1cbfbbd413d83f713584815938178.tar.gz
mailman2-6a23f43f94e1cbfbbd413d83f713584815938178.tar.xz
mailman2-6a23f43f94e1cbfbbd413d83f713584815938178.zip
sync with lp:mailman/2.1 (just same)
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)