Truncated links in Launchpad mailing lists automatic messages

Bug #394133 reported by David Planella
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Low
Barry Warsaw

Bug Description

Automatic messages sent from Launchpad mailing lists are wrapped at 72 characters.

Unfortunately, this includes any links in the message, which makes them unusable as such (i.e. they cannot be clicked) when they are truncated in this way.

Here's an example:

"
A message has been posted to the mailing list for your team, but this
message requires your approval before it will be sent to the list
members. After reviewing the message, you may approve, discard or
reject it.

To review all messages pending approval, visit:

    https://launchpad.net/~ubuntu-translation-coordinator/+mailinglist-
moderate
"

This is the extract from a request for moderation e-mail sent from a Launchpad mailing list. Notice the truncated link at the end of the message, which cannot be clicked, but rather needs to be copied and pasted to the browser's address bar.

A suggestion would be not to wrap (truncate) links.

I do not think this is specific to the e-mail client receiving the message, but just for the record I'm using Evolution 2.26.

Related branches

Curtis Hovey (sinzui)
affects: launchpad-foundations → launchpad-registry
Changed in launchpad-registry:
importance: Undecided → Low
status: New → Triaged
Barry Warsaw (barry)
tags: added: mailing-lists
Revision history for this message
Jonathan Lange (jml) wrote :

The branch I've linked doesn't fix the bug, but it demonstrates the problem. It turns out that textwrap (the Python module) will wrap lines at hyphens, even if those hyphens occur within URLs.

To run the unit test:
    ./bin/test -cvv lp.services.mail.tests.test_mailwrapper

If you like waiting for doctests:
    ./bin/test -1cvvt textformatting

It might be that the cheapest fix for this is to change the URL from +mailinglist-moderate to something without hyphens.

For reference:
  * template in lib/canonical/launchpad/emailtemplates/new-held-message.txt
  * mail handler in canonical.launchpad.mailnotification.notify_message_held
  * If you want to change the template text, you will have to edit:
    * lib/lp/registry/doc/message-holds-xmlrpc.txt
    * lib/lp/registry/doc/message-holds.txt
    * lib/lp/services/mailman/doc/postings.txt
  * If you want to change the URL, you'll have to edit:
    * lib/lp/registry/browser/configure.zcml
    * lib/lp/registry/browser/person.py
    * lib/lp/registry/stories/mailinglists/moderation.txt
    * and all the above.

Hope this helps,
jml

Revision history for this message
Barry Warsaw (barry) wrote :

Stupid ideas:

1. Change new-held-message.txt to stop at the "visit:" line, wrap that after substitution and then use string concatenation to add the %(review_url)s and closing.

2. Set force_wrap=False in notify_message_held() and see if that works. You may need to unfill the only paragraph in new-held-message.txt that you really care about wrapping.

Revision history for this message
Curtis Hovey (sinzui) wrote :

better idea:
    textwrap.wrap(break_long_words=False)

best idea:
    Updgrade to Pythong 2.6
    textwrap.wrap(break_on_hyphens=False)

Revision history for this message
Barry Warsaw (barry) wrote :

Idea #2 doesn't work.

Stupid idea #3:

Add a `nowrap_func` argument to MailWrapper.format(). If non-None, call this on every line the wrapper wants to wrap. If it matches, skip the wrapping.

Revision history for this message
Barry Warsaw (barry) wrote :

I have a branch implementing #3 and it works fairly well. I'll write a test and push the branch.

Curtis Hovey (sinzui)
Changed in launchpad-registry:
status: Triaged → In Progress
assignee: nobody → Barry Warsaw (barry)
Barry Warsaw (barry)
Changed in launchpad-registry:
milestone: none → 3.1.11
Barry Warsaw (barry)
Changed in launchpad-registry:
status: In Progress → Fix Committed
Barry Warsaw (barry)
Changed in launchpad-registry:
status: Fix Committed → Fix Released
Revision history for this message
David Planella (dpm) wrote :

While this is fixed for mailing lists, I've received another e-mail today where I've noticed that the links are also truncated. I'm not sure if I should report a new bug for that, but in the meantime I'll just add the comment on this one for the record.

See the e-mail below and notice the truncated LP URL:

"
Hello David Planella,

Aron Xu (happyaron) has been added as a member of Launchpad Translations
Coordinators (launchpad-translations-coordinators) by David Planella
(dpm). Follow the link below for more details.

    https://edge.launchpad.net/~launchpad-translations-
coordinators/+member/happyaron
"

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.