Package: enemies-of-carlotta
Version: 1.0.3-1
Severity: minor
Tags: patch
I think we already discussed about this on the mailing list, and the end
result was that you want to wait for the plugins.. In case I remember
wrong, and just so I don't lose this, here goes:
On a subscription moderated list, if a moderator sends email to
list-subscribe-foo=bar, the subscription confirmation message is
sent to the owners of the list. When they confirm, the subscription
sends a moderation request too. There's no point to do that.
Skip the confirmation and let the moderation perform that role, too.
diff -ru enemies-of-carlotta-1.0.3.orig/enemies-of-carlotta.1 enemies-of-carlotta-1.0.3/enemies-of-carlotta.1
--- enemies-of-carlotta-1.0.3.orig/enemies-of-carlotta.1 2003-09-07 15:00:53.000000000 +0300
+++ enemies-of-carlotta-1.0.3/enemies-of-carlotta.1 2004-07-21 14:28:19.000000000 +0300
@@ -443,6 +443,10 @@
.BR [EMAIL PROTECTED]
If a list owner sends mail like this, it is they who get the confirmation
request, not Joe.
+If the list is subscription moderated, there will be no separate
+confirmation request sent, as the subscription moderation message
+fulfills that role also.
+
It is generally better for people to subscribe themselves, but sometimes
list owners want to do it, when they have permission from the person
and feel helpful.
diff -ru enemies-of-carlotta-1.0.3.orig/eoc.py enemies-of-carlotta-1.0.3/eoc.py
--- enemies-of-carlotta-1.0.3.orig/eoc.py 2003-09-06 21:43:24.000000000 +0300
+++ enemies-of-carlotta-1.0.3/eoc.py 2004-07-21 15:21:23.000000000 +0300
@@ -589,8 +589,16 @@
if not subscriber:
subscriber = requester
- if requester in self.owners():
- confirmers = self.owners()
+ if requester in self.owners():
+ if (template_name == "sub-confirm"
+ and self.cp.get("list", "subscription") != "free"):
+ # no need to confirm subscription, as the request will
+ # be moderated anyway by the very same owners who
+ # would confirm it here.
+ assert "id" not in dict
+ dict["id"] = self.subscription_box.add(subscriber, origmail)
+ return self.moderate_sub(dict)
+ confirmers = self.owners()
else:
confirmers = [subscriber]
@@ -611,6 +619,22 @@
self.obey_subscribe_or_unsubscribe(dict, "unsub-confirm", "unsubyes",
origmail)
+ def moderate_sub(self, dict):
+ sender = self.command_address("help")
+ recipients = self.cp.get("list", "owners").split()
+ confirm = self.signed_address("subapprove", dict["id"])
+ deny = self.signed_address("subreject", dict["id"])
+ subscriber = self.subscription_box.get_address(dict["id"])
+ origmail = self.subscription_box.get(dict["id"])
+ self.send_template(self.ignore(), sender, recipients,
+ "sub-moderate",
+ {
+ "confirm": confirm,
+ "deny": deny,
+ "subscriber": subscriber,
+ "origmail": origmail,
+ })
+
def obey_subyes(self, dict):
if self.subscription_box.has(dict["id"]):
if self.cp.get("list", "subscription") == "free":
@@ -629,23 +653,11 @@
"address": recipient,
})
else:
- sender = self.command_address("help")
- recipients = self.cp.get("list", "owners").split()
- confirm = self.signed_address("subapprove", dict["id"])
- deny = self.signed_address("subreject", dict["id"])
- subscriber = self.subscription_box.get_address(dict["id"])
- origmail = self.subscription_box.get(dict["id"])
- self.send_template(self.ignore(), sender, recipients,
- "sub-moderate",
- {
- "confirm": confirm,
- "deny": deny,
- "subscriber": subscriber,
- "origmail": origmail,
- })
- recipient = self.subscription_box.get_address(dict["id"])
- self.send_template(self.ignore(), sender, [recipient],
- "sub-wait", {})
+ self.moderate_sub(dict)
+ sender = self.command_address("help")
+ recipient = self.subscription_box.get_address(dict["id"])
+ self.send_template(self.ignore(), sender, [recipient],
+ "sub-wait", {})
def obey_subapprove(self, dict):
if self.subscription_box.has(dict["id"]):
diff -ru enemies-of-carlotta-1.0.3.orig/eocTests.py enemies-of-carlotta-1.0.3/eocTests.py
--- enemies-of-carlotta-1.0.3.orig/eocTests.py 2003-07-16 19:11:49.000000000 +0300
+++ enemies-of-carlotta-1.0.3/eocTests.py 2004-07-21 15:27:25.000000000 +0300
@@ -499,8 +499,28 @@
"Welcome to the")
self.no_more_mail()
- def testOwnerUnubscribesSomeoneElse(self):
- self.configure_list("free", "free")
+ def testOwnerSubscribesSomeoneElse_Moderated(self):
+ self.configure_list("moderated", "free")
+
+ # Send subscription request. List sends moderation request.
+ self.send("[EMAIL PROTECTED]",
+ "[EMAIL PROTECTED]")
+ a = self.match("[EMAIL PROTECTED]",
+ "[EMAIL PROTECTED]@example.com",
+ "[EMAIL PROTECTED]",
+ "Please moderate subscription to ")
+ self.no_more_mail()
+
+ # Confirm sub. req. List sends welcome.
+ self.send("[EMAIL PROTECTED]", a)
+ self.match("[EMAIL PROTECTED]",
+ None,
+ "[EMAIL PROTECTED]",
+ "Welcome to the")
+ self.no_more_mail()
+
+ def owner_unubscribes_someoneelse_common(self, submoderation):
+ self.configure_list(submoderation, "free")
# Send unsubscription request. List sends confirmation request.
self.send("[EMAIL PROTECTED]",
@@ -517,6 +537,12 @@
"Goodbye")
self.no_more_mail()
+ def testOwnerUnubscribesSomeoneElse(self):
+ self.owner_unubscribes_someoneelse_common("free")
+
+ def testOwnerUnubscribesSomeoneElse_Moderated(self):
+ self.owner_unubscribes_someoneelse_common("moderated")
+
def subscribe_to_moderated_common(self, owner_reply_pattern):
self.configure_list("moderated", "free")