summaryrefslogtreecommitdiff
path: root/src/mailman/app/subscriptions.py
diff options
context:
space:
mode:
authorAnirudh Dahiya2016-03-11 17:47:19 +0530
committerBarry Warsaw2016-03-22 20:36:46 -0400
commitb798e2e751ee06e07d0966658f2b66e1c6174948 (patch)
treee35f53449713b947a0b553aa213c7a42271b3bd8 /src/mailman/app/subscriptions.py
parentf5948320648bd9c657dc41d4c6a9fd862d843714 (diff)
downloadmailman-b798e2e751ee06e07d0966658f2b66e1c6174948.tar.gz
mailman-b798e2e751ee06e07d0966658f2b66e1c6174948.tar.zst
mailman-b798e2e751ee06e07d0966658f2b66e1c6174948.zip
Diffstat (limited to 'src/mailman/app/subscriptions.py')
-rw-r--r--src/mailman/app/subscriptions.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mailman/app/subscriptions.py b/src/mailman/app/subscriptions.py
index e87eb9731..e901e1922 100644
--- a/src/mailman/app/subscriptions.py
+++ b/src/mailman/app/subscriptions.py
@@ -39,7 +39,7 @@ from mailman.interfaces.mailinglist import SubscriptionPolicy
from mailman.interfaces.member import MembershipIsBannedError
from mailman.interfaces.pending import IPendable, IPendings
from mailman.interfaces.registrar import ConfirmationNeededEvent
-from mailman.interfaces.subscriptions import ISubscriptionService, TokenOwner
+from mailman.interfaces.subscriptions import ISubscriptionService,SubscriptionPendingError,TokenOwner
from mailman.interfaces.user import IUser
from mailman.interfaces.usermanager import IUserManager
from mailman.interfaces.workflow import IWorkflowStateManager
@@ -185,6 +185,12 @@ class SubscriptionWorkflow(Workflow):
# Is this email address banned?
if IBanManager(self.mlist).is_banned(self.address.email):
raise MembershipIsBannedError(self.mlist, self.address.email)
+ # Check if the request for this email is already pending under
+ # moderation
+ pendings = getUtility(IPendings).find(mlist=self.mlist,pend_type='subscription')
+ for token,pendable in pendings:
+ if pendable['email']==self.address.email and pendable['token_owner']=='moderator':
+ raise SubscriptionPendingError(self.address.email, self.mlist)
# Start out with the subscriber being the token owner.
self.push('verification_checks')