summaryrefslogtreecommitdiff
path: root/src/mailman/rules/docs/news-moderation.rst
blob: b77bc4dc186e8380f53b8afdf289d8903483f1f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
====================
Newsgroup moderation
====================

The ``news-moderation`` rule matches all messages posted to mailing lists that
gateway to a moderated newsgroup.  The reason for this is that such messages
must get forwarded on to the newsgroup moderator.  From there it will get
posted to the newsgroup, and from there, gated to the mailing list.  It's a
circuitous route, but it works nonetheless by holding all messages posted
directly to the mailing list.

    >>> mlist = create_list('_xtest@example.com')
    >>> rule = config.rules['news-moderation']
    >>> print(rule.name)
    news-moderation

Set the list configuration variable to enable newsgroup moderation.

    >>> from mailman.interfaces.nntp import NewsgroupModeration
    >>> mlist.newsgroup_moderation = NewsgroupModeration.moderated

And now all messages will match the rule.

    >>> msg = message_from_string("""\
    ... From: aperson@example.org
    ... Subject: An announcement
    ...
    ... Great things are happening.
    ... """)
    >>> rule.check(mlist, msg, {})
    True

When moderation is turned off, the rule does not match.

    >>> mlist.newsgroup_moderation = NewsgroupModeration.none
    >>> rule.check(mlist, msg, {})
    False