Merge lp:~thomir/launchpad/devel-fix-editemails-link into lp:launchpad
- devel-fix-editemails-link
- Merge into devel
| Status: | Merged | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Merged at revision: | 17362 | ||||||||
| Proposed branch: | lp:~thomir/launchpad/devel-fix-editemails-link | ||||||||
| Merge into: | lp:launchpad | ||||||||
| Diff against target: |
778 lines (+286/-190) 14 files modified
lib/lp/registry/browser/configure.zcml (+6/-0) lib/lp/registry/browser/person.py (+144/-88) lib/lp/registry/browser/tests/test_person.py (+7/-0) lib/lp/registry/doc/teammembership-email-notification.txt (+2/-2) lib/lp/registry/mail/notification.py (+2/-2) lib/lp/registry/stories/mailinglists/subscriptions.txt (+17/-17) lib/lp/registry/stories/person/xx-person-home.txt (+3/-1) lib/lp/registry/stories/team/xx-team-membership.txt (+1/-1) lib/lp/registry/templates/person-editemails.pt (+4/-73) lib/lp/registry/templates/person-editmailinglists.pt (+86/-0) lib/lp/registry/templates/person-participation.pt (+1/-1) lib/lp/registry/templates/person-portlet-contact-details.pt (+11/-3) lib/lp/registry/templates/team-portlet-mailinglist.pt (+1/-1) lib/lp/registry/tests/test_mailinglist.py (+1/-1) |
||||||||
| To merge this branch: | bzr merge lp:~thomir/launchpad/devel-fix-editemails-link | ||||||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| William Grant | code | 2015-02-26 | Approve on 2015-02-27 |
|
Review via email:
|
|||
Commit Message
Add new +editmailinglists page to manage mailing list subscriptions, which have been removed from +editemails.
Description of the Change
This branch splits the +editemails page in 'twain:
* +editemails continues to be the place to add email addresses to an account, and to configure your preferred contact address. It requires a fresh login, since this is changing your login credentials.
* +editmailinglists is a new page which allows you to configure the mailing lists you're subscribed to, as well as set your mailing list auto-subscribe policy.
This branch fixes two bugs:
https:/
and
https:/
Preview Diff
| 1 | === modified file 'lib/lp/registry/browser/configure.zcml' |
| 2 | --- lib/lp/registry/browser/configure.zcml 2015-02-06 13:37:58 +0000 |
| 3 | +++ lib/lp/registry/browser/configure.zcml 2015-02-27 01:11:47 +0000 |
| 4 | @@ -1010,6 +1010,12 @@ |
| 5 | template="../templates/person-editemails.pt"/> |
| 6 | </browser:pages> |
| 7 | <browser:page |
| 8 | + for="lp.registry.interfaces.person.IPerson" |
| 9 | + permission="launchpad.Edit" |
| 10 | + class="lp.registry.browser.person.PersonEditMailingListsView" |
| 11 | + name="+editmailinglists" |
| 12 | + template="../templates/person-editmailinglists.pt"/> |
| 13 | + <browser:page |
| 14 | name="+oauth-tokens" |
| 15 | for="lp.registry.interfaces.person.IPerson" |
| 16 | class="lp.registry.browser.person.PersonOAuthTokensView" |
| 17 | |
| 18 | === modified file 'lib/lp/registry/browser/person.py' |
| 19 | --- lib/lp/registry/browser/person.py 2015-02-06 13:37:58 +0000 |
| 20 | +++ lib/lp/registry/browser/person.py 2015-02-27 01:11:47 +0000 |
| 21 | @@ -723,6 +723,7 @@ |
| 22 | 'branding', |
| 23 | 'editemailaddresses', |
| 24 | 'editlanguages', |
| 25 | + 'editmailinglists', |
| 26 | 'editircnicknames', |
| 27 | 'editjabberids', |
| 28 | 'editsshkeys', |
| 29 | @@ -782,6 +783,12 @@ |
| 30 | return Link(target, text, icon='edit') |
| 31 | |
| 32 | @enabled_with_permission('launchpad.Edit') |
| 33 | + def editmailinglists(self): |
| 34 | + target = '+editmailinglists' |
| 35 | + text = 'Manage mailing list subscriptions' |
| 36 | + return Link(target, text, icon='edit') |
| 37 | + |
| 38 | + @enabled_with_permission('launchpad.Edit') |
| 39 | def editircnicknames(self): |
| 40 | target = '+editircnicknames' |
| 41 | text = 'Update IRC nicknames' |
| 42 | @@ -2722,8 +2729,6 @@ |
| 43 | orientation='vertical') |
| 44 | custom_widget('UNVALIDATED_SELECTED', LaunchpadRadioWidget, |
| 45 | orientation='vertical') |
| 46 | - custom_widget('mailing_list_auto_subscribe_policy', |
| 47 | - LaunchpadRadioWidgetWithDescription) |
| 48 | |
| 49 | label = 'Change your e-mail settings' |
| 50 | |
| 51 | @@ -2746,9 +2751,7 @@ |
| 52 | self.form_fields = (self._validated_emails_field() + |
| 53 | self._unvalidated_emails_field() + |
| 54 | FormFields(TextLine(__name__='newemail', |
| 55 | - title=u'Add a new address')) |
| 56 | - + self._mailing_list_fields() |
| 57 | - + self._autosubscribe_policy_fields()) |
| 58 | + title=u'Add a new address'))) |
| 59 | |
| 60 | @property |
| 61 | def initial_values(self): |
| 62 | @@ -2769,20 +2772,8 @@ |
| 63 | unvalidated = self.unvalidated_addresses |
| 64 | if len(unvalidated) > 0: |
| 65 | unvalidated = unvalidated.pop() |
| 66 | - initial = dict(VALIDATED_SELECTED=validated, |
| 67 | - UNVALIDATED_SELECTED=unvalidated) |
| 68 | - |
| 69 | - # Defaults for the mailing list autosubscribe buttons. |
| 70 | - policy = self.context.mailing_list_auto_subscribe_policy |
| 71 | - initial.update(mailing_list_auto_subscribe_policy=policy) |
| 72 | - |
| 73 | - return initial |
| 74 | - |
| 75 | - def setUpWidgets(self, context=None): |
| 76 | - """See `LaunchpadFormView`.""" |
| 77 | - super(PersonEditEmailsView, self).setUpWidgets(context) |
| 78 | - widget = self.widgets['mailing_list_auto_subscribe_policy'] |
| 79 | - widget.display_label = False |
| 80 | + return dict(VALIDATED_SELECTED=validated, |
| 81 | + UNVALIDATED_SELECTED=unvalidated) |
| 82 | |
| 83 | def _validated_emails_field(self): |
| 84 | """Create a field with a vocabulary of validated emails. |
| 85 | @@ -2824,75 +2815,6 @@ |
| 86 | source=SimpleVocabulary(terms)), |
| 87 | custom_widget=self.custom_widgets['UNVALIDATED_SELECTED']) |
| 88 | |
| 89 | - def _mailing_list_subscription_type(self, mailing_list): |
| 90 | - """Return the context user's subscription type for the given list. |
| 91 | - |
| 92 | - This is 'Preferred address' if the user is subscribed using her |
| 93 | - preferred address and 'Don't subscribe' if the user is not |
| 94 | - subscribed at all. Otherwise it's the EmailAddress under |
| 95 | - which the user is subscribed to this mailing list. |
| 96 | - """ |
| 97 | - subscription = mailing_list.getSubscription(self.context) |
| 98 | - if subscription is None: |
| 99 | - return "Don't subscribe" |
| 100 | - elif subscription.email_address is None: |
| 101 | - return 'Preferred address' |
| 102 | - else: |
| 103 | - return subscription.email_address |
| 104 | - |
| 105 | - def _mailing_list_fields(self): |
| 106 | - """Creates a field for each mailing list the user can subscribe to. |
| 107 | - |
| 108 | - If a team doesn't have a mailing list, or the mailing list |
| 109 | - isn't usable, it's not included. |
| 110 | - """ |
| 111 | - mailing_list_set = getUtility(IMailingListSet) |
| 112 | - fields = [] |
| 113 | - terms = [ |
| 114 | - SimpleTerm("Preferred address"), |
| 115 | - SimpleTerm("Don't subscribe"), |
| 116 | - ] |
| 117 | - for email in self.validated_addresses: |
| 118 | - terms.append(SimpleTerm(email, email.email)) |
| 119 | - for team in self.context.teams_participated_in: |
| 120 | - mailing_list = mailing_list_set.get(team.name) |
| 121 | - if mailing_list is not None and mailing_list.is_usable: |
| 122 | - name = 'subscription.%s' % team.name |
| 123 | - value = self._mailing_list_subscription_type(mailing_list) |
| 124 | - field = Choice(__name__=name, |
| 125 | - title=team.name, |
| 126 | - source=SimpleVocabulary(terms), default=value) |
| 127 | - fields.append(field) |
| 128 | - return FormFields(*fields) |
| 129 | - |
| 130 | - def _autosubscribe_policy_fields(self): |
| 131 | - """Create a field for each mailing list auto-subscription option.""" |
| 132 | - return FormFields( |
| 133 | - Choice(__name__='mailing_list_auto_subscribe_policy', |
| 134 | - title=_('When should Launchpad automatically subscribe ' |
| 135 | - 'you to a team’s mailing list?'), |
| 136 | - source=MailingListAutoSubscribePolicy)) |
| 137 | - |
| 138 | - @property |
| 139 | - def mailing_list_widgets(self): |
| 140 | - """Return all the mailing list subscription widgets.""" |
| 141 | - mailing_list_set = getUtility(IMailingListSet) |
| 142 | - widgets = [] |
| 143 | - for widget in self.widgets: |
| 144 | - if widget.name.startswith('field.subscription.'): |
| 145 | - team_name = widget.label |
| 146 | - mailing_list = mailing_list_set.get(team_name) |
| 147 | - assert mailing_list is not None, 'Missing mailing list' |
| 148 | - widget_dict = dict( |
| 149 | - team=mailing_list.team, |
| 150 | - widget=widget, |
| 151 | - ) |
| 152 | - widgets.append(widget_dict) |
| 153 | - # We'll put the label in the first column, so don't include it |
| 154 | - # in the second column. |
| 155 | - widget.display_label = False |
| 156 | - return widgets |
| 157 | - |
| 158 | def _validate_selected_address(self, data, field='VALIDATED_SELECTED'): |
| 159 | """A generic validator for this view's actions. |
| 160 | |
| 161 | @@ -3125,6 +3047,140 @@ |
| 162 | "message for up to an hour or two.)" % newemail) |
| 163 | self.next_url = self.action_url |
| 164 | |
| 165 | + |
| 166 | +class PersonEditMailingListsView(LaunchpadFormView): |
| 167 | + """A view for editing a person's mailing list subscriptions.""" |
| 168 | + |
| 169 | + implements(IPersonEditMenu) |
| 170 | + |
| 171 | + schema = IEmailAddress |
| 172 | + |
| 173 | + custom_widget('mailing_list_auto_subscribe_policy', |
| 174 | + LaunchpadRadioWidgetWithDescription) |
| 175 | + |
| 176 | + label = 'Change your mailing list subscriptions' |
| 177 | + |
| 178 | + def initialize(self): |
| 179 | + if self.context.is_team: |
| 180 | + # +editmailinglists is not available on teams. |
| 181 | + name = self.request['PATH_INFO'].split('/')[-1] |
| 182 | + raise NotFound(self, name, request=self.request) |
| 183 | + super(PersonEditMailingListsView, self).initialize() |
| 184 | + |
| 185 | + def setUpFields(self): |
| 186 | + """Set up fields for this view. |
| 187 | + |
| 188 | + The main fields of interest are the selection fields with custom |
| 189 | + vocabularies for the lists of validated and unvalidated email |
| 190 | + addresses. |
| 191 | + """ |
| 192 | + super(PersonEditMailingListsView, self).setUpFields() |
| 193 | + self.form_fields = (self._mailing_list_fields() |
| 194 | + + self._autosubscribe_policy_fields()) |
| 195 | + |
| 196 | + @property |
| 197 | + def initial_values(self): |
| 198 | + """Set up default values for the radio widgets. |
| 199 | + |
| 200 | + A radio widget must have a selected value, so we select the |
| 201 | + first unvalidated and validated email addresses in the lists |
| 202 | + to be the default for the corresponding widgets. |
| 203 | + |
| 204 | + The only exception is if the user has a preferred email |
| 205 | + address: then, that address is used as the default validated |
| 206 | + email address. |
| 207 | + """ |
| 208 | + # Defaults for the mailing list autosubscribe buttons. |
| 209 | + return dict( |
| 210 | + mailing_list_auto_subscribe_policy= |
| 211 | + self.context.mailing_list_auto_subscribe_policy) |
| 212 | + |
| 213 | + def setUpWidgets(self, context=None): |
| 214 | + """See `LaunchpadFormView`.""" |
| 215 | + super(PersonEditMailingListsView, self).setUpWidgets(context) |
| 216 | + widget = self.widgets['mailing_list_auto_subscribe_policy'] |
| 217 | + widget.display_label = False |
| 218 | + |
| 219 | + def _mailing_list_subscription_type(self, mailing_list): |
| 220 | + """Return the context user's subscription type for the given list. |
| 221 | + |
| 222 | + This is 'Preferred address' if the user is subscribed using her |
| 223 | + preferred address and 'Don't subscribe' if the user is not |
| 224 | + subscribed at all. Otherwise it's the EmailAddress under |
| 225 | + which the user is subscribed to this mailing list. |
| 226 | + """ |
| 227 | + subscription = mailing_list.getSubscription(self.context) |
| 228 | + if subscription is None: |
| 229 | + return "Don't subscribe" |
| 230 | + elif subscription.email_address is None: |
| 231 | + return 'Preferred address' |
| 232 | + else: |
| 233 | + return subscription.email_address |
| 234 | + |
| 235 | + def _mailing_list_fields(self): |
| 236 | + """Creates a field for each mailing list the user can subscribe to. |
| 237 | + |
| 238 | + If a team doesn't have a mailing list, or the mailing list |
| 239 | + isn't usable, it's not included. |
| 240 | + """ |
| 241 | + mailing_list_set = getUtility(IMailingListSet) |
| 242 | + fields = [] |
| 243 | + terms = [ |
| 244 | + SimpleTerm("Preferred address"), |
| 245 | + SimpleTerm("Don't subscribe"), |
| 246 | + ] |
| 247 | + for email in self.validated_addresses: |
| 248 | + terms.append(SimpleTerm(email, email.email)) |
| 249 | + for team in self.context.teams_participated_in: |
| 250 | + mailing_list = mailing_list_set.get(team.name) |
| 251 | + if mailing_list is not None and mailing_list.is_usable: |
| 252 | + name = 'subscription.%s' % team.name |
| 253 | + value = self._mailing_list_subscription_type(mailing_list) |
| 254 | + field = Choice(__name__=name, |
| 255 | + title=team.name, |
| 256 | + source=SimpleVocabulary(terms), default=value) |
| 257 | + fields.append(field) |
| 258 | + return FormFields(*fields) |
| 259 | + |
| 260 | + def _autosubscribe_policy_fields(self): |
| 261 | + """Create a field for each mailing list auto-subscription option.""" |
| 262 | + return FormFields( |
| 263 | + Choice(__name__='mailing_list_auto_subscribe_policy', |
| 264 | + title=_('When should Launchpad automatically subscribe ' |
| 265 | + 'you to a team’s mailing list?'), |
| 266 | + source=MailingListAutoSubscribePolicy)) |
| 267 | + |
| 268 | + @property |
| 269 | + def mailing_list_widgets(self): |
| 270 | + """Return all the mailing list subscription widgets.""" |
| 271 | + mailing_list_set = getUtility(IMailingListSet) |
| 272 | + widgets = [] |
| 273 | + for widget in self.widgets: |
| 274 | + if widget.name.startswith('field.subscription.'): |
| 275 | + team_name = widget.label |
| 276 | + mailing_list = mailing_list_set.get(team_name) |
| 277 | + assert mailing_list is not None, 'Missing mailing list' |
| 278 | + widget_dict = dict( |
| 279 | + team=mailing_list.team, |
| 280 | + widget=widget, |
| 281 | + ) |
| 282 | + widgets.append(widget_dict) |
| 283 | + # We'll put the label in the first column, so don't include it |
| 284 | + # in the second column. |
| 285 | + widget.display_label = False |
| 286 | + return widgets |
| 287 | + |
| 288 | + @property |
| 289 | + def validated_addresses(self): |
| 290 | + """All of this person's validated email addresses, including |
| 291 | + their preferred address (if any). |
| 292 | + """ |
| 293 | + addresses = [] |
| 294 | + if self.context.preferredemail: |
| 295 | + addresses.append(self.context.preferredemail) |
| 296 | + addresses += list(self.context.validatedemails) |
| 297 | + return addresses |
| 298 | + |
| 299 | def validate_action_update_subscriptions(self, action, data): |
| 300 | """Make sure the user is subscribing using a valid address. |
| 301 | |
| 302 | |
| 303 | === modified file 'lib/lp/registry/browser/tests/test_person.py' |
| 304 | --- lib/lp/registry/browser/tests/test_person.py 2014-11-29 00:21:14 +0000 |
| 305 | +++ lib/lp/registry/browser/tests/test_person.py 2015-02-27 01:11:47 +0000 |
| 306 | @@ -683,6 +683,13 @@ |
| 307 | browser = setupBrowserForUser(user=self.person) |
| 308 | self.assertRaises(NotFound, browser.open, url) |
| 309 | |
| 310 | + def test_team_editmailinglists_not_found(self): |
| 311 | + """Teams should not have a +editmailinglists page.""" |
| 312 | + team = self.factory.makeTeam(owner=self.person, members=[self.person]) |
| 313 | + url = '%s/+editmailinglists' % canonical_url(team) |
| 314 | + browser = setupBrowserForUser(user=self.person) |
| 315 | + self.assertRaises(NotFound, browser.open, url) |
| 316 | + |
| 317 | def test_email_string_validation_no_email_prodvided(self): |
| 318 | """+editemails should warn if no email is provided.""" |
| 319 | no_email = '' |
| 320 | |
| 321 | === modified file 'lib/lp/registry/doc/teammembership-email-notification.txt' |
| 322 | --- lib/lp/registry/doc/teammembership-email-notification.txt 2012-08-13 19:34:10 +0000 |
| 323 | +++ lib/lp/registry/doc/teammembership-email-notification.txt 2015-02-27 01:11:47 +0000 |
| 324 | @@ -818,7 +818,7 @@ |
| 325 | <BLANKLINE> |
| 326 | If you would like to subscribe to the team list, use the link below |
| 327 | to update your Mailing List Subscription preferences. |
| 328 | - <http://launchpad.dev/people/+me/+editemails> |
| 329 | + <http://launchpad.dev/people/+me/+editmailinglists> |
| 330 | <BLANKLINE> |
| 331 | -- = |
| 332 | <BLANKLINE> |
| 333 | @@ -843,7 +843,7 @@ |
| 334 | <BLANKLINE> |
| 335 | If you would like to subscribe to the team list, use the link below |
| 336 | to update your Mailing List Subscription preferences. |
| 337 | - <http://launchpad.dev/people/+me/+editemails> |
| 338 | + <http://launchpad.dev/people/+me/+editmailinglists> |
| 339 | <BLANKLINE> |
| 340 | -- = |
| 341 | <BLANKLINE> |
| 342 | |
| 343 | === modified file 'lib/lp/registry/mail/notification.py' |
| 344 | --- lib/lp/registry/mail/notification.py 2012-11-26 18:50:14 +0000 |
| 345 | +++ lib/lp/registry/mail/notification.py 2015-02-27 01:11:47 +0000 |
| 346 | @@ -148,7 +148,7 @@ |
| 347 | 'team-list-subscribe-block.txt', app='registry') |
| 348 | editemails_url = urlappend( |
| 349 | canonical_url(getUtility(ILaunchpadRoot)), |
| 350 | - 'people/+me/+editemails') |
| 351 | + 'people/+me/+editmailinglists') |
| 352 | list_instructions = template % dict(editemails_url=editemails_url) |
| 353 | else: |
| 354 | list_instructions = '' |
| 355 | @@ -257,7 +257,7 @@ |
| 356 | headers = {} |
| 357 | subject = "New Mailing List for %s" % team.displayname |
| 358 | template = get_email_template('new-mailing-list.txt', app='registry') |
| 359 | - editemails_url = '%s/+editemails' |
| 360 | + editemails_url = '%s/+editmailinglists' |
| 361 | |
| 362 | for person in team.allmembers: |
| 363 | if person.is_team or person.preferredemail is None: |
| 364 | |
| 365 | === modified file 'lib/lp/registry/stories/mailinglists/subscriptions.txt' |
| 366 | --- lib/lp/registry/stories/mailinglists/subscriptions.txt 2014-01-30 15:04:06 +0000 |
| 367 | +++ lib/lp/registry/stories/mailinglists/subscriptions.txt 2015-02-27 01:11:47 +0000 |
| 368 | @@ -69,7 +69,7 @@ |
| 369 | >>> logout() |
| 370 | >>> no_team_browser = setupBrowserFreshLogin(person) |
| 371 | |
| 372 | - >>> no_team_browser.open('http://launchpad.dev/people/+me/+editemails') |
| 373 | + >>> no_team_browser.open('http://launchpad.dev/people/+me/+editmailinglists') |
| 374 | >>> rosetta_admins = no_team_browser.getControl( |
| 375 | ... name='field.subscription.rosetta-admins') |
| 376 | >>> rosetta_admins.displayOptions |
| 377 | @@ -89,11 +89,11 @@ |
| 378 | >>> logout() |
| 379 | >>> carlos_browser = setupBrowserFreshLogin(carlos) |
| 380 | >>> carlos_browser.open('http://launchpad.dev/~carlos') |
| 381 | - >>> carlos_browser.getLink(url="+editemails").click() |
| 382 | + >>> carlos_browser.getLink(url="+editmailinglists").click() |
| 383 | |
| 384 | >>> from lp.services.helpers import backslashreplace |
| 385 | >>> print backslashreplace(carlos_browser.title) |
| 386 | - Change your e-mail settings... |
| 387 | + Change your mailing list subscriptions... |
| 388 | |
| 389 | >>> admins = carlos_browser.getControl(name='field.subscription.admins') |
| 390 | >>> rosetta_admins = carlos_browser.getControl( |
| 391 | @@ -198,9 +198,9 @@ |
| 392 | Admins team, and he should know if the list is available. |
| 393 | |
| 394 | >>> carlos_browser.open('http://launchpad.dev/~carlos') |
| 395 | - >>> carlos_browser.getLink(url="+editemails").click() |
| 396 | + >>> carlos_browser.getLink(url="+editmailinglists").click() |
| 397 | >>> print backslashreplace(carlos_browser.title) |
| 398 | - Change your e-mail settings... |
| 399 | + Change your mailing list subscriptions... |
| 400 | |
| 401 | >>> rosetta_admins = carlos_browser.getControl( |
| 402 | ... name='field.subscription.rosetta-admins') |
| 403 | @@ -236,9 +236,9 @@ |
| 404 | >>> logout() |
| 405 | >>> jdub_browser = setupBrowserFreshLogin(jdub) |
| 406 | >>> jdub_browser.open('http://launchpad.dev/~jdub') |
| 407 | - >>> jdub_browser.getLink(url="+editemails").click() |
| 408 | + >>> jdub_browser.getLink(url="+editmailinglists").click() |
| 409 | >>> print jdub_browser.title |
| 410 | - Change your e-mail settings... |
| 411 | + Change your mailing list subscriptions... |
| 412 | |
| 413 | >>> jdub_browser.getControl( |
| 414 | ... name='field.subscription.rosetta-admins') |
| 415 | @@ -260,9 +260,9 @@ |
| 416 | His mailing list subscription is now available to be managed. |
| 417 | |
| 418 | >>> jdub_browser.open('http://launchpad.dev/~jdub') |
| 419 | - >>> jdub_browser.getLink(url="+editemails").click() |
| 420 | + >>> jdub_browser.getLink(url="+editmailinglists").click() |
| 421 | >>> print jdub_browser.title |
| 422 | - Change your e-mail settings... |
| 423 | + Change your mailing list subscriptions... |
| 424 | |
| 425 | >>> rosetta_team = jdub_browser.getControl( |
| 426 | ... name='field.subscription.rosetta-admins') |
| 427 | @@ -327,14 +327,14 @@ |
| 428 | >>> carlos_browser.open('http://launchpad.dev/~admins') |
| 429 | >>> carlos_browser.getLink('Subscribe to mailing list').click() |
| 430 | >>> print carlos_browser.url |
| 431 | - http://launchpad.dev/~carlos/+editemails |
| 432 | + http://launchpad.dev/~carlos/+editmailinglists |
| 433 | |
| 434 | The unsubscribe link is visible for the rosetta admins team, which |
| 435 | has an active mailing list. |
| 436 | |
| 437 | # Subscribe to the list using the normal technique. |
| 438 | >>> carlos_browser.open('http://launchpad.dev/~carlos') |
| 439 | - >>> carlos_browser.getLink(url="+editemails").click() |
| 440 | + >>> carlos_browser.getLink(url="+editmailinglists").click() |
| 441 | >>> rosetta_admins = carlos_browser.getControl( |
| 442 | ... name='field.subscription.rosetta-admins') |
| 443 | >>> rosetta_admins.value = ['Preferred address'] |
| 444 | @@ -469,9 +469,9 @@ |
| 445 | list based on a setting in the person's Email preferences page. |
| 446 | |
| 447 | >>> carlos_browser.open('http://launchpad.dev/~carlos') |
| 448 | - >>> carlos_browser.getLink(url="+editemails").click() |
| 449 | + >>> carlos_browser.getLink(url="+editmailinglists").click() |
| 450 | >>> print backslashreplace(carlos_browser.title) |
| 451 | - Change your e-mail settings... |
| 452 | + Change your mailing list subscriptions... |
| 453 | |
| 454 | Carlos's default setting, 'Ask me when I join a team', is still in place. |
| 455 | |
| 456 | @@ -549,7 +549,7 @@ |
| 457 | >>> logout() |
| 458 | >>> browser = setupBrowserFreshLogin(james) |
| 459 | >>> browser.open('http://launchpad.dev/~jblack') |
| 460 | - >>> browser.getLink(url="+editemails").click() |
| 461 | + >>> browser.getLink(url="+editmailinglists").click() |
| 462 | >>> print_radio_button_field(browser.contents, |
| 463 | ... 'mailing_list_auto_subscribe_policy') |
| 464 | ( ) Never subscribe to mailing lists |
| 465 | @@ -566,7 +566,7 @@ |
| 466 | |
| 467 | # Change James' setting |
| 468 | >>> browser.open('http://launchpad.dev/~jblack') |
| 469 | - >>> browser.getLink(url="+editemails").click() |
| 470 | + >>> browser.getLink(url="+editmailinglists").click() |
| 471 | >>> set_autosubscribe_policy_and_submit('ALWAYS', browser) |
| 472 | ( ) Never subscribe to mailing lists |
| 473 | ( ) Ask me when I join a team |
| 474 | @@ -582,7 +582,7 @@ |
| 475 | |
| 476 | # Change James' setting |
| 477 | >>> browser.open('http://launchpad.dev/~jblack') |
| 478 | - >>> browser.getLink(url="+editemails").click() |
| 479 | + >>> browser.getLink(url="+editmailinglists").click() |
| 480 | >>> set_autosubscribe_policy_and_submit('NEVER', browser) |
| 481 | (*) Never subscribe to mailing lists |
| 482 | ( ) Ask me when I join a team |
| 483 | @@ -595,7 +595,7 @@ |
| 484 | |
| 485 | # Restore James' setting. |
| 486 | >>> browser.open('http://launchpad.dev/~jblack') |
| 487 | - >>> browser.getLink(url="+editemails").click() |
| 488 | + >>> browser.getLink(url="+editmailinglists").click() |
| 489 | >>> set_autosubscribe_policy_and_submit('ON_REGISTRATION', browser) |
| 490 | ( ) Never subscribe to mailing lists |
| 491 | (*) Ask me when I join a team |
| 492 | |
| 493 | === modified file 'lib/lp/registry/stories/person/xx-person-home.txt' |
| 494 | --- lib/lp/registry/stories/person/xx-person-home.txt 2012-03-25 07:19:12 +0000 |
| 495 | +++ lib/lp/registry/stories/person/xx-person-home.txt 2015-02-27 01:11:47 +0000 |
| 496 | @@ -48,9 +48,11 @@ |
| 497 | >>> admin_browser.open('http://launchpad.dev/~name12') |
| 498 | >>> print extract_text( |
| 499 | ... find_tag_by_id(admin_browser.contents, 'email-addresses')) |
| 500 | - Email: Change e-mail settings |
| 501 | + Email: |
| 502 | test@canonical.com |
| 503 | testing@canonical.com |
| 504 | + Change e-mail settings |
| 505 | + Manage mailing list subscriptions |
| 506 | |
| 507 | |
| 508 | Open ID link |
| 509 | |
| 510 | === modified file 'lib/lp/registry/stories/team/xx-team-membership.txt' |
| 511 | --- lib/lp/registry/stories/team/xx-team-membership.txt 2012-01-15 11:06:57 +0000 |
| 512 | +++ lib/lp/registry/stories/team/xx-team-membership.txt 2015-02-27 01:11:47 +0000 |
| 513 | @@ -247,7 +247,7 @@ |
| 514 | >>> user_browser.getLink('Register a team') |
| 515 | <Link ... url='http://.../people/+newteam'> |
| 516 | >>> user_browser.getLink('Change mailing list subscriptions') |
| 517 | - <Link ... url='http://.../~no-priv/+editemails'> |
| 518 | + <Link ... url='http://.../~no-priv/+editmailinglists'> |
| 519 | |
| 520 | Teams also have a participation page, but it does not include a mailing |
| 521 | list column. |
| 522 | |
| 523 | === modified file 'lib/lp/registry/templates/person-editemails.pt' |
| 524 | --- lib/lp/registry/templates/person-editemails.pt 2012-06-28 01:47:35 +0000 |
| 525 | +++ lib/lp/registry/templates/person-editemails.pt 2015-02-27 01:11:47 +0000 |
| 526 | @@ -19,6 +19,10 @@ |
| 527 | id="no-contact-address"> |
| 528 | Currently you don't have a contact address in Launchpad. |
| 529 | </p> |
| 530 | + <p>Looking to <a |
| 531 | + tal:define="link context/menu:overview/editmailinglists" |
| 532 | + tal:attributes="href link/target" |
| 533 | + >configure your mailing list subscriptions</a>?</p> |
| 534 | </metal:extra-info> |
| 535 | |
| 536 | <metal:widgets fill-slot="widgets"> |
| 537 | @@ -70,79 +74,6 @@ |
| 538 | </metal:widgets> |
| 539 | <metal:widgets fill-slot="buttons" /> |
| 540 | </div> |
| 541 | - |
| 542 | - |
| 543 | - <form action="" |
| 544 | - method="post" enctype="multipart/form-data" |
| 545 | - accept-charset="UTF-8" tal:condition="view/mailing_list_widgets"> |
| 546 | - |
| 547 | - <h2>Mailing list subscriptions</h2> |
| 548 | - |
| 549 | - <p>You're a member of one or more teams with active mailing |
| 550 | - lists. You can subscribe to a team's mailing list using any of |
| 551 | - your verified email addresses.</p> |
| 552 | - |
| 553 | - <table class="listing" style="width: 45em;"> |
| 554 | - <thead> |
| 555 | - <th style="white-space:nowrap;">For mailing list</th> |
| 556 | - <th>Subscribe with</th> |
| 557 | - </thead> |
| 558 | - <tbody> |
| 559 | - <tr tal:repeat="widget view/mailing_list_widgets"> |
| 560 | - <td tal:content="structure widget/team/fmt:link">Team</td> |
| 561 | - <td tal:content="structure widget/widget">Widget</td> |
| 562 | - </tr> |
| 563 | - </tbody> |
| 564 | - </table> |
| 565 | - <div style="padding-top: 1em; padding-bottom: 1em;"> |
| 566 | - <input tal:replace="structure view/action_update_subscriptions/render" /> |
| 567 | - </div> |
| 568 | - </form> |
| 569 | - |
| 570 | - <form action="" |
| 571 | - method="post" enctype="multipart/form-data" |
| 572 | - accept-charset="UTF-8"> |
| 573 | - |
| 574 | - <h2>Automatic subscription to mailing lists</h2> |
| 575 | - |
| 576 | - <div id="notification-info">When a team you are a member of creates a new |
| 577 | - mailing list, you will receive an email notification offering you the |
| 578 | - opportunity to join the new mailing list. Launchpad can also |
| 579 | - automatically subscribe you to a team's mailing list whenever you |
| 580 | - join a team.</div> |
| 581 | - |
| 582 | - <tal:widget |
| 583 | - define="widget nocall:view/widgets/mailing_list_auto_subscribe_policy"> |
| 584 | - <table class="form"> |
| 585 | - |
| 586 | - <thead> |
| 587 | - <tr> |
| 588 | - <th style="white-space:nowrap; text-align:left;"> |
| 589 | - <div style="margin-bottom: 1em;"> |
| 590 | - <label tal:attributes="for widget/name" |
| 591 | - tal:content="structure widget/label" /> |
| 592 | - </div> |
| 593 | - </th> |
| 594 | - <td></td> |
| 595 | - </tr> |
| 596 | - </thead> |
| 597 | - |
| 598 | - <tbody> |
| 599 | - <metal:block use-macro="context/@@launchpad_form/widget_row" /> |
| 600 | - <tr> |
| 601 | - <td> |
| 602 | - <input |
| 603 | - tal:replace="structure |
| 604 | - view/action_update_autosubscribe_policy/render" /> |
| 605 | - </td> |
| 606 | - <td></td> |
| 607 | - </tr> |
| 608 | - </tbody> |
| 609 | - |
| 610 | - </table> |
| 611 | - </tal:widget> |
| 612 | - </form> |
| 613 | - |
| 614 | </div> |
| 615 | </body> |
| 616 | </html> |
| 617 | |
| 618 | === added file 'lib/lp/registry/templates/person-editmailinglists.pt' |
| 619 | --- lib/lp/registry/templates/person-editmailinglists.pt 1970-01-01 00:00:00 +0000 |
| 620 | +++ lib/lp/registry/templates/person-editmailinglists.pt 2015-02-27 01:11:47 +0000 |
| 621 | @@ -0,0 +1,86 @@ |
| 622 | +<html |
| 623 | + xmlns="http://www.w3.org/1999/xhtml" |
| 624 | + xmlns:tal="http://xml.zope.org/namespaces/tal" |
| 625 | + xmlns:metal="http://xml.zope.org/namespaces/metal" |
| 626 | + xmlns:i18n="http://xml.zope.org/namespaces/i18n" |
| 627 | + metal:use-macro="view/macro:page/main_only" |
| 628 | + i18n:domain="launchpad" |
| 629 | +> |
| 630 | + <body> |
| 631 | +<div metal:fill-slot="main"> |
| 632 | + <form action="" |
| 633 | + method="post" enctype="multipart/form-data" |
| 634 | + accept-charset="UTF-8" tal:condition="view/mailing_list_widgets"> |
| 635 | + |
| 636 | + <p>You're a member of one or more teams with active mailing |
| 637 | + lists. You can subscribe to a team's mailing list using any of |
| 638 | + <a |
| 639 | + tal:define="link context/menu:overview/editemailaddresses" |
| 640 | + tal:attributes="href link/target"> |
| 641 | + your verified email addresses</a>. |
| 642 | + </p> |
| 643 | + |
| 644 | + <table class="listing" style="width: 45em;"> |
| 645 | + <thead> |
| 646 | + <th style="white-space:nowrap;">For mailing list</th> |
| 647 | + <th>Subscribe with</th> |
| 648 | + </thead> |
| 649 | + <tbody> |
| 650 | + <tr tal:repeat="widget view/mailing_list_widgets"> |
| 651 | + <td tal:content="structure widget/team/fmt:link">Team</td> |
| 652 | + <td tal:content="structure widget/widget">Widget</td> |
| 653 | + </tr> |
| 654 | + </tbody> |
| 655 | + </table> |
| 656 | + <div style="padding-top: 1em; padding-bottom: 1em;"> |
| 657 | + <input tal:replace="structure view/action_update_subscriptions/render" /> |
| 658 | + </div> |
| 659 | + </form> |
| 660 | + |
| 661 | + <form action="" |
| 662 | + method="post" enctype="multipart/form-data" |
| 663 | + accept-charset="UTF-8"> |
| 664 | + |
| 665 | + <h2>Automatic subscription</h2> |
| 666 | + |
| 667 | + <div id="notification-info">When a team you are a member of creates a new |
| 668 | + mailing list, you will receive an email notification offering you the |
| 669 | + opportunity to join the new mailing list. Launchpad can also |
| 670 | + automatically subscribe you to a team's mailing list whenever you |
| 671 | + join a team.</div> |
| 672 | + |
| 673 | + <tal:widget |
| 674 | + define="widget nocall:view/widgets/mailing_list_auto_subscribe_policy"> |
| 675 | + <table class="form"> |
| 676 | + |
| 677 | + <thead> |
| 678 | + <tr> |
| 679 | + <th style="white-space:nowrap; text-align:left;"> |
| 680 | + <div style="margin-bottom: 1em;"> |
| 681 | + <label tal:attributes="for widget/name" |
| 682 | + tal:content="structure widget/label" /> |
| 683 | + </div> |
| 684 | + </th> |
| 685 | + <td></td> |
| 686 | + </tr> |
| 687 | + </thead> |
| 688 | + |
| 689 | + <tbody> |
| 690 | + <metal:block use-macro="context/@@launchpad_form/widget_row" /> |
| 691 | + <tr> |
| 692 | + <td> |
| 693 | + <input |
| 694 | + tal:replace="structure |
| 695 | + view/action_update_autosubscribe_policy/render" /> |
| 696 | + </td> |
| 697 | + <td></td> |
| 698 | + </tr> |
| 699 | + </tbody> |
| 700 | + |
| 701 | + </table> |
| 702 | + </tal:widget> |
| 703 | + </form> |
| 704 | + |
| 705 | +</div> |
| 706 | +</body> |
| 707 | +</html> |
| 708 | |
| 709 | === modified file 'lib/lp/registry/templates/person-participation.pt' |
| 710 | --- lib/lp/registry/templates/person-participation.pt 2012-06-11 00:47:38 +0000 |
| 711 | +++ lib/lp/registry/templates/person-participation.pt 2015-02-27 01:11:47 +0000 |
| 712 | @@ -76,7 +76,7 @@ |
| 713 | </li> |
| 714 | <li> |
| 715 | <a class="sprite edit" |
| 716 | - tal:attributes="href context/menu:overview/editemailaddresses/fmt:url" |
| 717 | + tal:attributes="href context/menu:overview/editmailinglists/fmt:url" |
| 718 | >Change mailing list subscriptions</a> |
| 719 | </li> |
| 720 | </ul> |
| 721 | |
| 722 | === modified file 'lib/lp/registry/templates/person-portlet-contact-details.pt' |
| 723 | --- lib/lp/registry/templates/person-portlet-contact-details.pt 2012-06-15 16:23:50 +0000 |
| 724 | +++ lib/lp/registry/templates/person-portlet-contact-details.pt 2015-02-27 01:11:47 +0000 |
| 725 | @@ -15,9 +15,7 @@ |
| 726 | <dd tal:content="context/name"/> |
| 727 | </dl> |
| 728 | <dl id="email-addresses"> |
| 729 | - <dt>Email: |
| 730 | - <a tal:replace="structure overview_menu/editemailaddresses/fmt:icon" /> |
| 731 | - </dt> |
| 732 | + <dt>Email:</dt> |
| 733 | <dd |
| 734 | tal:attributes="title view/visible_email_address_description"> |
| 735 | <tal:not_logged_in |
| 736 | @@ -49,6 +47,16 @@ |
| 737 | </span> |
| 738 | </tal:emails> |
| 739 | </dd> |
| 740 | + <dd> |
| 741 | + <a |
| 742 | + tal:define="link context/menu:overview/editemailaddresses" |
| 743 | + tal:condition="link/enabled" |
| 744 | + tal:content="structure link/fmt:link" /><br /> |
| 745 | + <a |
| 746 | + tal:define="link context/menu:overview/editmailinglists" |
| 747 | + tal:condition="link/enabled" |
| 748 | + tal:content="structure link/fmt:link" /> |
| 749 | + </dd> |
| 750 | </dl> |
| 751 | |
| 752 | |
| 753 | |
| 754 | === modified file 'lib/lp/registry/templates/team-portlet-mailinglist.pt' |
| 755 | --- lib/lp/registry/templates/team-portlet-mailinglist.pt 2012-07-06 06:02:33 +0000 |
| 756 | +++ lib/lp/registry/templates/team-portlet-mailinglist.pt 2015-02-27 01:11:47 +0000 |
| 757 | @@ -22,7 +22,7 @@ |
| 758 | <tal:can-subscribe-to-list |
| 759 | condition="view/user_can_subscribe_to_list"> |
| 760 | <a id="link-list-subscribe" class="sprite add" |
| 761 | - href="/people/+me/+editemails">Subscribe to mailing list</a> |
| 762 | + href="/people/+me/+editmailinglists">Subscribe to mailing list</a> |
| 763 | <br /> |
| 764 | </tal:can-subscribe-to-list> |
| 765 | <tal:subscribed-to-list |
| 766 | |
| 767 | === modified file 'lib/lp/registry/tests/test_mailinglist.py' |
| 768 | --- lib/lp/registry/tests/test_mailinglist.py 2013-01-11 01:05:14 +0000 |
| 769 | +++ lib/lp/registry/tests/test_mailinglist.py 2015-02-27 01:11:47 +0000 |
| 770 | @@ -169,7 +169,7 @@ |
| 771 | self.assertEqual( |
| 772 | 'New Mailing List for Team', notifications[0]['subject']) |
| 773 | self.assertTextMatchesExpressionIgnoreWhitespace( |
| 774 | - '.*To subscribe:.*http://launchpad.dev/~.*/\+editemails.*', |
| 775 | + '.*To subscribe:.*http://launchpad.dev/~.*/\+editmailinglists.*', |
| 776 | notifications[0].get_payload()) |
| 777 | |
| 778 | def test_startConstructing_from_APPROVED(self): |

Just a few super-trivial niggles!