summaryrefslogtreecommitdiff
path: root/src/mailman/commands/eml_membership.py
diff options
context:
space:
mode:
authorBarry Warsaw2016-09-13 19:43:34 +1200
committerBarry Warsaw2016-09-13 19:43:34 +1200
commit74c7d6d1d089864fe01a3f2502314c31508a4781 (patch)
tree13ebba81466850b64b4fb909018aa09694806d8f /src/mailman/commands/eml_membership.py
parente18e7ac34e8b4b2f88d5987ccb76a39c54c61c0c (diff)
downloadmailman-74c7d6d1d089864fe01a3f2502314c31508a4781.tar.gz
mailman-74c7d6d1d089864fe01a3f2502314c31508a4781.tar.zst
mailman-74c7d6d1d089864fe01a3f2502314c31508a4781.zip
Diffstat (limited to 'src/mailman/commands/eml_membership.py')
-rw-r--r--src/mailman/commands/eml_membership.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/mailman/commands/eml_membership.py b/src/mailman/commands/eml_membership.py
index 223552ea5..9194ebe21 100644
--- a/src/mailman/commands/eml_membership.py
+++ b/src/mailman/commands/eml_membership.py
@@ -182,11 +182,20 @@ You may be asked to confirm your request.""")
if member is not None:
break
else:
- # None of the user's addresses are subscribed to this mailing list.
- print(_(
- '$self.name: $email is not a member of $mlist.fqdn_listname'),
- file=results)
+ # There are two possible situations. Either none of the user's
+ # addresses are subscribed to this mailing list, or this command
+ # email *already* unsubscribed the user from the mailing list.
+ # E.g. if a message was sent to the -leave address and it
+ # contained the 'leave' command. Don't send a bogus response in
+ # this case, just ignore subsequent leaves of the same address.
+ print(_('$self.name: $email is not a member of '
+ '$mlist.fqdn_listname'), file=results)
return ContinueProcessing.no
+ already_left = msgdata.setdefault('leaves', set())
+ if email in already_left:
+ return ContinueProcessing.yes
+ # Ignore any subsequent 'leave' commands.
+ already_left.add(email)
manager = getAdapter(mlist, ISubscriptionManager, name='unsubscribe')
token, token_owner, member = manager.unregister(user_address)
person = formataddr((user.display_name, email)) # noqa