Merge lp:~msapiro/mailman/topics into lp:mailman/2.2

Proposed by Mark Sapiro
Status: Needs review
Proposed branch: lp:~msapiro/mailman/topics
Merge into: lp:mailman/2.2
Diff against target: 193 lines (+70/-33)
5 files modified
Mailman/Cgi/options.py (+34/-5)
Mailman/Gui/Topics.py (+4/-2)
Mailman/Handlers/CalcRecips.py (+6/-5)
Mailman/versions.py (+10/-0)
templates/en/options.html (+16/-21)
To merge this branch: bzr merge lp:~msapiro/mailman/topics
Reviewer Review Type Date Requested Status
Barry Warsaw design code Pending
Review via email: mp+2598@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Mark Sapiro (msapiro) wrote :

This proposal is to merge a fix for bug #255418 to allow a list member to receive all messages which match no defined topic without receiving any messages which match any topics. Review of both the design of the fix and the code are requested.

lp:~msapiro/mailman/topics updated
1010. By Mark Sapiro

Merged changes from 2.2 branch.

1011. By Mark Sapiro

Merged changes from 2.2 branch.

1012. By Mark Sapiro

Merged changes from 2.2 branch

1013. By Mark Sapiro

Merged changes from 2.2 branch.

1014. By Mark Sapiro

Merged changes from 2.2 branch.

1015. By Mark Sapiro

Merged changes from 2.2 branch.

1016. By Mark Sapiro

Merges from 2.2 branch

1017. By Mark Sapiro

Merges from 2.2 branch

1018. By Mark Sapiro

Merged changes from 2.2 branch

1019. By Mark Sapiro

Merged change from 2.2 branch

1020. By Mark Sapiro

Merged changes from 2.2 branch.

1021. By Mark Sapiro

Merged changes from 2.2 branch.

1022. By Mark Sapiro

Merged the 2.2 branch.

Unmerged revisions

1022. By Mark Sapiro

Merged the 2.2 branch.

1021. By Mark Sapiro

Merged changes from 2.2 branch.

1020. By Mark Sapiro

Merged changes from 2.2 branch.

1019. By Mark Sapiro

Merged change from 2.2 branch

1018. By Mark Sapiro

Merged changes from 2.2 branch

1017. By Mark Sapiro

Merges from 2.2 branch

1016. By Mark Sapiro

Merges from 2.2 branch

1015. By Mark Sapiro

Merged changes from 2.2 branch.

1014. By Mark Sapiro

Merged changes from 2.2 branch.

1013. By Mark Sapiro

Merged changes from 2.2 branch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Mailman/Cgi/options.py'
2--- Mailman/Cgi/options.py 2014-11-08 01:22:26 +0000
3+++ Mailman/Cgi/options.py 2014-12-03 23:52:29 +0000
4@@ -569,7 +569,6 @@
5 ('disablemail', mm_cfg.DisableDelivery),
6 ('conceal', mm_cfg.ConcealSubscription),
7 ('remind', mm_cfg.SuppressPasswordReminder),
8- ('rcvtopic', mm_cfg.ReceiveNonmatchingTopics),
9 ('nodupes', mm_cfg.DontReceiveDuplicates),
10 ):
11 try:
12@@ -619,6 +618,7 @@
13 topicnames = [topicnames]
14 # unquote the topic names
15 topicnames = [urllib.unquote_plus(n) for n in topicnames]
16+ rcvtopic = int(cgidata.getvalue('rcvtopic'), 0)
17
18 # The standard sigterm handler (see above)
19 def sigterm_handler(signum, frame, mlist=mlist):
20@@ -646,6 +646,21 @@
21 mustdigest = 1
22 # Set the topics information.
23 mlist.setMemberTopics(user, topicnames)
24+ # And the non-matching option
25+ if rcvtopic == 1:
26+ mlist.setMemberOption(user, mm_cfg.ReceiveNonmatchingTopics, 1)
27+ elif rcvtopic == 0:
28+ mlist.setMemberOption(user, mm_cfg.ReceiveNonmatchingTopics, 0)
29+ if topicnames:
30+ doc.addError(
31+ _('With selected topics All is coerced to Only'),
32+ tag=_('Notice: '))
33+ else:
34+ mlist.setMemberOption(user, mm_cfg.ReceiveNonmatchingTopics, 0)
35+ if not topicnames:
36+ doc.addError(
37+ _('With no selected topics Only is coerced to All'),
38+ tag=_('Notice: '))
39 mlist.Save()
40 finally:
41 mlist.Unlock()
42@@ -854,10 +869,24 @@
43 else:
44 topicsfield = _('<em>No topics defined</em>')
45 replacements['<mm-topics>'] = topicsfield
46- replacements['<mm-suppress-nonmatching-topics>'] = (
47- mlist.FormatOptionButton(mm_cfg.ReceiveNonmatchingTopics, 0, user))
48- replacements['<mm-receive-nonmatching-topics>'] = (
49- mlist.FormatOptionButton(mm_cfg.ReceiveNonmatchingTopics, 1, user))
50+ # Figure out the nonmatching selection
51+ if not mlist.topics or (not usertopics and not
52+ mlist.getMemberOption(user, mm_cfg.ReceiveNonmatchingTopics)):
53+ topicselectval = 0
54+ elif (usertopics and not
55+ mlist.getMemberOption(user, mm_cfg.ReceiveNonmatchingTopics)):
56+ topicselectval = 2
57+ else:
58+ topicselectval = 1
59+ table = Table(border="0")
60+ table.AddRow([RadioButton('rcvtopic', 2, checked=topicselectval==2),
61+ _('Only')])
62+ table.AddRow([RadioButton('rcvtopic', 1, checked=topicselectval==1),
63+ _('Non-match')])
64+ table.AddRow([RadioButton('rcvtopic', 0, checked=topicselectval==0),
65+ _('All')])
66+ topicselection = table.Format()
67+ replacements['<mm-nonmatching-topics-selection>'] = topicselection
68
69 if cpuser is not None:
70 replacements['<mm-case-preserved-user>'] = _('''
71
72=== modified file 'Mailman/Gui/Topics.py'
73--- Mailman/Gui/Topics.py 2009-02-09 23:30:34 +0000
74+++ Mailman/Gui/Topics.py 2014-12-03 23:52:29 +0000
75@@ -56,8 +56,10 @@
76 match against a topic filter, the message is logically placed
77 into a topic <em>bucket</em>. Each user can then choose to only
78 receive messages from the mailing list for a particular topic
79- bucket (or buckets). Any message not categorized in a topic
80- bucket registered with the user is not delivered to the list.
81+ bucket (or buckets). Any message categorized only in topic
82+ buckets not registered with the user is not delivered to the
83+ user. Additionally, the user can also choose whether or not to
84+ receive those messages not categorized in any topic bucket.
85
86 <p>Note that this feature only works with regular delivery, not
87 digest delivery.
88
89=== modified file 'Mailman/Handlers/CalcRecips.py'
90--- Mailman/Handlers/CalcRecips.py 2014-09-19 16:24:03 +0000
91+++ Mailman/Handlers/CalcRecips.py 2014-12-03 23:52:29 +0000
92@@ -116,9 +116,10 @@
93 # who are interested in one of the hit topics.
94 for user in recips:
95 utopics = mlist.getMemberTopics(user)
96- if not utopics:
97- # This user is not interested in any topics, so they get all
98- # postings.
99+ if (not utopics and
100+ not mlist.getMemberOption(user,
101+ mm_cfg.ReceiveNonmatchingTopics)):
102+ # This user wants all postings.
103 continue
104 # BAW: Slow, first-match, set intersection!
105 for topic in utopics:
106@@ -132,8 +133,8 @@
107 else:
108 # The semantics for a message that did not hit any of the pre-canned
109 # topics is to troll through the membership list, looking for users
110- # who selected at least one topic of interest, but turned on
111- # ReceiveNonmatchingTopics.
112+ # who selected no topics, or who selected at least one topic of
113+ # interest, but turned on ReceiveNonmatchingTopics.
114 for user in recips:
115 if not mlist.getMemberTopics(user):
116 # The user did not select any topics of interest, so he gets
117
118=== modified file 'Mailman/versions.py'
119--- Mailman/versions.py 2014-10-17 15:43:49 +0000
120+++ Mailman/versions.py 2014-12-03 23:52:29 +0000
121@@ -322,6 +322,16 @@
122 for name, pattern, description, emptyflag in stored_state['topics']:
123 pattern = Utils.strip_verbose_pattern(pattern)
124 l.topics.append((name, pattern, description, emptyflag))
125+ #
126+ # If pre 2.2 list has topics and regular member has no selection, make
127+ # sure ReceiveNonmatchingTopics is off for the member.
128+ #
129+ if stored_state['data_version'] <= 97:
130+ if l.topics:
131+ for member in l.members.keys():
132+ if not l.getMemberTopics(member):
133+ l.setMemberOption(member,
134+ mm_cfg.ReceiveNonmatchingTopics, 0)
135 # from_is_list was called author_is_list in 2.1.16rc2 (only).
136 PreferStored('author_is_list', 'from_is_list',
137 mm_cfg.DEFAULT_FROM_IS_LIST)
138
139=== modified file 'templates/en/options.html'
140--- templates/en/options.html 2004-11-13 23:57:05 +0000
141+++ templates/en/options.html 2014-12-03 23:52:29 +0000
142@@ -251,35 +251,30 @@
143 By selecting one or more topics, you can filter the
144 traffic on the mailing list, so as to receive only a
145 subset of the messages. If a message matches one of
146- your selected topics, then you will get the message,
147- otherwise you will not.
148+ your selected topics, then you will get the message;
149+ if it matches only non-selected topics, you will not.
150
151 <p>If a message does not match any topic, the delivery
152- rule depends on the setting of the option below. If
153- you do not select any topics of interest, you will get
154- all the messages sent to the mailing list.
155+ rule depends on the setting of the option below.
156+
157+ <p>Topics apply only to individual messages. Digest members
158+ receive digests containing all messages regardless of topic.
159 </td><td bgcolor="#cccccc">
160 <mm-topics>
161 </td></tr>
162
163 <tr><td bgcolor="#cccccc">
164- <strong>Do you want to receive messages that do not match any
165- topic filter?</strong><p>
166-
167- This option only takes effect if you've subscribed to
168- at least one topic above. It describes what the
169- default delivery rule is for messages that don't match
170- any topic filter. Selecting <em>No</em> says that if
171- the message does not match any topic filters, then you
172- won't get the message, while selecting <em>Yes</em>
173- says to deliver such non-matching messages to you.
174-
175- <p>If no topics of interest are selected above, then
176- you will receive every message sent to the mailing
177- list.
178+ <strong>Which messages do you want to receive?</strong><p>
179+ This option describes what the delivery rule is if
180+ there are defined topics above. Selecting <em>Only</em>
181+ says that you will only receive messages which match
182+ topics you have selected above. Selecting <em>Non-match</em>
183+ says that you will receive messages which match your
184+ selected topics if any plus those messages which don't
185+ match any topics. Selecting <em>All</em> says you will
186+ receive all messages regardless of topic.
187 </td><td bgcolor="#cccccc">
188- <mm-suppress-nonmatching-topics>No<br>
189- <mm-receive-nonmatching-topics>Yes
190+ <mm-nonmatching-topics-selection>
191 </td></tr>
192
193 <tr><td bgcolor="#cccccc">

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: