summaryrefslogtreecommitdiff
path: root/src/mailman/rules/docs
diff options
context:
space:
mode:
authorBarry Warsaw2010-12-29 23:54:08 -0500
committerBarry Warsaw2010-12-29 23:54:08 -0500
commit534e90fea33c52585c74fa9127cca8b70178d5e0 (patch)
tree3a5d4088b5af1a4b310dffba711389ac67792dd2 /src/mailman/rules/docs
parenta31184862fc52a3c38059f832d533b137135c1f9 (diff)
downloadmailman-534e90fea33c52585c74fa9127cca8b70178d5e0.tar.gz
mailman-534e90fea33c52585c74fa9127cca8b70178d5e0.tar.zst
mailman-534e90fea33c52585c74fa9127cca8b70178d5e0.zip
Fairly significant change to the way member and nonmember moderation occurs.
Now, nonmembers are represented by a separate roster of IMembers, the latter which has grown a `moderation_action` enum. When that action is `defer`, then the normal processing rules apply. Anything else and the `moderation` chain is jumped to for a shortcut to moderation (which may include immediate acceptance). TODO: handle unregistered nonmembers. Details: * The member-moderation rule is renamed to just moderation, and handles both members and nonmembers (though the latter must currently be registered). * The moderation rule is moved up in the builtin chain. It is now checked after `approved`, `emergency`, and `loop`, but before the normal moderation checks. This means that nonmember postings will be (by default) held much earlier. * IMember.is_moderated is removed. * IMember.moderation_action is added. * IMailingList.default_member_moderation is removed. * IMailingList.default_member_action and IMailingList.default_nonmember_action are added. * MemberRole.nonmember is added.
Diffstat (limited to 'src/mailman/rules/docs')
-rw-r--r--src/mailman/rules/docs/moderation.txt103
-rw-r--r--src/mailman/rules/docs/rules.txt3
2 files changed, 63 insertions, 43 deletions
diff --git a/src/mailman/rules/docs/moderation.txt b/src/mailman/rules/docs/moderation.txt
index 96ad8b6c3..ce88c8576 100644
--- a/src/mailman/rules/docs/moderation.txt
+++ b/src/mailman/rules/docs/moderation.txt
@@ -2,74 +2,95 @@
Member moderation
=================
-Each user has a moderation flag. When set, and the list is set to moderate
-postings, then only members with a cleared moderation flag will be able to
-email the list without having those messages be held for approval. The
-'moderation' rule determines whether the message should be moderated or not.
+All members and nonmembers have a moderation action. When the action is not
+`defer`, the `moderation` rule flags the message as needing a moderation
+shortcut. This might be to automatically accept, discard, reject, or hold the
+message.
- >>> mlist = create_list('_xtest@example.com')
- >>> rule = config.rules['member-moderation']
+ >>> mlist = create_list('test@example.com')
+ >>> rule = config.rules['moderation']
>>> print rule.name
- member-moderation
-
-In the simplest case, the sender is not a member of the mailing list, so the
-moderation rule can't match.
-
- >>> msg = message_from_string("""\
- ... From: aperson@example.org
- ... To: _xtest@example.com
- ... Subject: A posted message
- ...
- ... """)
- >>> rule.check(mlist, msg, {})
- False
+ moderation
Let's add the message author as a non-moderated member.
+::
+ >>> from mailman.interfaces.member import MemberRole
>>> from mailman.interfaces.usermanager import IUserManager
+
>>> from zope.component import getUtility
>>> user = getUtility(IUserManager).create_user(
... 'aperson@example.org', 'Anne Person')
-Because the member is not moderated, the rule does not match.
-
>>> address = list(user.addresses)[0]
- >>> from mailman.interfaces.member import MemberRole
>>> member = address.subscribe(mlist, MemberRole.member)
- >>> member.is_moderated
- False
+ >>> print member.moderation_action
+ Action.defer
+
+Because the member is not moderated, the rule does not match.
+
+ >>> msg = message_from_string("""\
+ ... From: aperson@example.org
+ ... To: test@example.com
+ ... Subject: A posted message
+ ...
+ ... """)
>>> rule.check(mlist, msg, {})
False
-Once the member's moderation flag is set though, the rule matches.
+Once the member's moderation action is set to something other than `defer`,
+the rule matches. Also, the message metadata has a few extra pieces of
+information for the eventual moderation chain.
- >>> member.is_moderated = True
- >>> rule.check(mlist, msg, {})
+ >>> from mailman.interfaces.action import Action
+ >>> member.moderation_action = Action.hold
+ >>> msgdata = {}
+ >>> rule.check(mlist, msg, msgdata)
True
+ >>> dump_msgdata(msgdata)
+ moderation_action: hold
+ moderation_sender: aperson@example.org
-Non-members
-===========
+Nonmembers
+==========
-There is another, related rule for matching non-members, which simply matches
-if the sender is *not* a member of the mailing list.
+Nonmembers are handled in a similar way, although by default, nonmember
+postings are held for moderator approval.
- >>> rule = config.rules['non-member']
- >>> print rule.name
- non-member
-
-If the sender is a member of this mailing list, the rule does not match.
+ >>> user = getUtility(IUserManager).create_user(
+ ... 'bperson@example.org', 'Bart Person')
- >>> rule.check(mlist, msg, {})
- False
+ >>> address = list(user.addresses)[0]
+ >>> nonmember = address.subscribe(mlist, MemberRole.nonmember)
+ >>> print nonmember.moderation_action
+ Action.hold
-But if the sender is not a member of this mailing list, the rule matches.
+Because the sender's moderation action is to hold by default, the rule
+matches. Again, the message metadata carries some useful information.
>>> msg = message_from_string("""\
... From: bperson@example.org
- ... To: _xtest@example.com
+ ... To: test@example.com
... Subject: A posted message
...
... """)
- >>> rule.check(mlist, msg, {})
+ >>> msgdata = {}
+ >>> rule.check(mlist, msg, msgdata)
True
+ >>> dump_msgdata(msgdata)
+ moderation_action: hold
+ moderation_sender: bperson@example.org
+
+Of course, the nonmember action can be set to defer the decision, in which
+case the rule does not match.
+
+ >>> nonmember.moderation_action = Action.defer
+ >>> rule.check(mlist, msg, {})
+ False
+
+
+Unregistered nonmembers
+=======================
+
+XXX
diff --git a/src/mailman/rules/docs/rules.txt b/src/mailman/rules/docs/rules.txt
index 056e39cab..321f1b277 100644
--- a/src/mailman/rules/docs/rules.txt
+++ b/src/mailman/rules/docs/rules.txt
@@ -26,10 +26,9 @@ names to rule objects.
loop True
max-recipients True
max-size True
- member-moderation True
+ moderation True
news-moderation True
no-subject True
- non-member True
suspicious-header True
truth True