Merge lp:~sinzui/launchpad/moderate-empty-messages into lp:launchpad
| Status: | Merged | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Approved by: | Henning Eggers on 2010-04-06 | ||||||||
| Approved revision: | no longer in the source branch. | ||||||||
| Merged at revision: | not available | ||||||||
| Proposed branch: | lp:~sinzui/launchpad/moderate-empty-messages | ||||||||
| Merge into: | lp:launchpad | ||||||||
| Diff against target: |
132 lines (+65/-6) 2 files modified
lib/canonical/launchpad/mailman/monkeypatches/lpmoderate.py (+16/-0) lib/lp/services/mailman/doc/postings.txt (+49/-6) |
||||||||
| To merge this branch: | bzr merge lp:~sinzui/launchpad/moderate-empty-messages | ||||||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Henning Eggers (community) | code | 2010-04-06 | Approve on 2010-04-06 |
|
Review via email:
|
|||
Description of the Change
This is my branch to prevent empty messages from entering the moderation queue.
lp:~sinzui/launchpad/moderate-empty-messages
Diff size: 121
Launchpad bug: https:/
Test command: ./bin/test -vv --layer=Mailman -t postings
Pre-
Target release: 10.04
Prevent empty messages from entering the moderation queue
-------
Launchpad only supports text/plain email messages, but mailman is asking
users to moderate text/html or image/* messages. Moderators see a subject with
no body. Besides the insanity of this case, there are two bugs that directly
relate to these messages:
Bug 498741 [spam offered for moderation on a ML]
More that 99% of all spam in the moderation queue have no body.
Bug 498740 [timeout trying to moderate a mailing list with many messages]
The number of spam messages causes timeouts.
Note that no user has ever complained that Launchpad does not support
non-text messages. We should discard any message that has not meaningful
content.
Rules
-----
* Iterate over all the parts of each message that mailman call hold()
on. If there are no text parts with 1 or more non-white-space, raise
Errors.
QA
--
* On staging, send an image only or html-only message to haibunku from
a non-subscribed address.
* Most spam messages purport to be from the list itself, eg
"spam" <email address hidden>.
* Verify the message does not appear in the moderation queue.
* On staging send a normal email (with a text part) from the same address.
* Verify that the message is in the moderation queue.
* On staging, send an image only or html-only message to haibunku from
your real address (assuming you are a list member)
* Verify the message arrives to the list members.
Lint
----
Linting changed files:
lib/canonical
lib/lp/
Test
----
* lib/lp/
* Revised the large message size test to look like real examples.
Barry and I felt that these tests looked like spam according to
the new rule and would probably fail when the code is added.
* Added tests to verify that list members can send non-text messages,
but such messages from non-members are discarded.
Implementation
--------------
* lib/canonical/
* Added a guard to the hold() function to ensure that non-text
messages are discarded.
| Curtis Hovey (sinzui) wrote : | # |
Hi Henning.
Thanks for the review.
On Tue, 2010-04-06 at 15:51 +0000, Henning Eggers wrote:
> Review: Approve code
...
> > Rules
> > -----
> >
> > * Iterate over all the parts of each message that mailman call hold()
> > on. If there are no text parts with 1 or more non-white-space, raise
> > Errors.
>
> I do not know the inner workings of the Mailman code but I trust that you and
> Barry came up with The Right Thing here ... ;-)
Yes. I was perplexed by how to locate a text/plain part reliably. Barry
pointed me to the iterators.
> >
> >
> > QA
> > --
> >
> > * On staging, send an image only or html-only message to haibunku from
> > a non-subscribed address.
> > * Most spam messages purport to be from the list itself, eg
> > "spam"<email address hidden>.
> > * Verify the message does not appear in the moderation queue.
> > * On staging send a normal email (with a text part) from the same address.
> > * Verify that the message is in the moderation queue.
> > * On staging, send an image only or html-only message to haibunku from
> > your real address (assuming you are a list member)
> > * Verify the message arrives to the list members.
>
> Only question I have here is how to send emails on staging?
Staging has a separate mailman. The team page lists the staging mailman
address. Just send the messages to the listed address. Barry and I can
see the messages that go to haibunku.
...
> > Implementation
> > --------------
> >
> > * lib/canonical/
> > * Added a guard to the hold() function to ensure that non-text
> > messages are discarded.
> >
>
> I am not familiar with the overall structure of the file but wouldn't it have
> been nicer to put that guard into it's own function?
I like your suggestion.
> > === modified file 'lib/canonical/
> > --- lib/canonical/
> > +++ lib/canonical/
...
> > @@ -73,6 +74,18 @@
> > syslog('vette',
> > 'Discarding duplicate held message-id: %s', message_id)
> > raise Errors.
> > + # Discard messages without text content since there will be nothing to
> > + # moderate. Most of these messages are spam.
> > + has_content = False
> > + for part in typed_subpart_
> > + if part.get_
> > + if len(part.
> > + has_content = True
> > + break
>
> Yes, at least this loop could be put in a function:
>
> def is_message_
> for part in typed_subpart_
> if part.get_
> if len(part.
> return False
> return True
>
> > + if not has_content:
>
> if is_message_
Yes. That is much better.
> > + syslog('vette',
> Not ...

Hi Curtis
thank you for this branch and making moderators lifes easier!
Pleae find my commengs in-line.
Am 06.04.2010 16:45, schrieb Curtis Hovey: ------- ------- ------- ------- ------- ------- ------- --
> Prevent empty messages from entering the moderation queue
> -------
>
> Launchpad only supports text/plain email messages, but mailman is asking
> users to moderate text/html or image/* messages. Moderators see a subject with
> no body. Besides the insanity of this case, there are two bugs that directly
> relate to these messages:
>
> Bug 498741 [spam offered for moderation on a ML]
> More that 99% of all spam in the moderation queue have no body.
> Bug 498740 [timeout trying to moderate a mailing list with many messages]
> The number of spam messages causes timeouts.
Too bugs in one branch? Nice hunting! ;-)
> DiscardMessage
> Note that no user has ever complained that Launchpad does not support
> non-text messages. We should discard any message that has not meaningful
> content.
>
>
> Rules
> -----
>
> * Iterate over all the parts of each message that mailman call hold()
> on. If there are no text parts with 1 or more non-white-space, raise
> Errors.
I do not know the inner workings of the Mailman code but I trust that you and
Barry came up with The Right Thing here ... ;-)
>
>
> QA
> --
>
> * On staging, send an image only or html-only message to haibunku from
> a non-subscribed address.
> * Most spam messages purport to be from the list itself, eg
> "spam"<email address hidden>.
> * Verify the message does not appear in the moderation queue.
> * On staging send a normal email (with a text part) from the same address.
> * Verify that the message is in the moderation queue.
> * On staging, send an image only or html-only message to haibunku from
> your real address (assuming you are a list member)
> * Verify the message arrives to the list members.
Only question I have here is how to send emails on staging?
> launchpad/ mailman/ monkeypatches/ lpmoderate. py services/ mailman/ doc/postings. txt services/ mailman/ doc/postings. txt launchpad/ mailman/ monkeypatches/ lpmoderate. py
>
> Lint
> ----
>
> Linting changed files:
> lib/canonical/
> lib/lp/
>
>
>
> Test
> ----
>
> * lib/lp/
> * Revised the large message size test to look like real examples.
> Barry and I felt that these tests looked like spam according to
> the new rule and would probably fail when the code is added.
> * Added tests to verify that list members can send non-text messages,
> but such messages from non-members are discarded.
>
>
> Implementation
> --------------
>
> * lib/canonical/
> * Added a guard to the hold() function to ensure that non-text
> messages are discarded.
>
I am not familiar with the overall structure of the file but wouldn't it have
been nicer to put that guard into it's own function?
> === modified file 'lib/canonical/ launchpad/ mailman/ monkeypatches/ lpmoderate. py' launchpad/ mailman/ monkeypatches/ lpmoderate. py 2009-10-01 15:36:20 +0000
> --- lib/canonical/
> +++ li...