Merge lp:~sinzui/launchpad/unactivated-profile-0 into lp:launchpad

Proposed by Curtis Hovey
Status: Merged
Approved by: Brad Crittenden
Approved revision: no longer in the source branch.
Merged at revision: 11038
Proposed branch: lp:~sinzui/launchpad/unactivated-profile-0
Merge into: lp:launchpad
Diff against target: 123 lines (+61/-27)
3 files modified
lib/lp/registry/stories/person/xx-person-home.txt (+47/-0)
lib/lp/registry/stories/person/xx-set-preferredemail.txt (+0/-14)
lib/lp/registry/templates/person-index.pt (+14/-13)
To merge this branch: bzr merge lp:~sinzui/launchpad/unactivated-profile-0
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Review via email: mp+27950@code.launchpad.net

Description of the change

This is my branch to hide email addresses on unactivated profile page.

    lp:~sinzui/launchpad/unactivated-profile-0
    Diff size: 98
    Launchpad bug:
          https://bugs.launchpad.net/bugs/595983
    Test command: ./bin/test -vv \
          -t xx-person-home.txt
    Pre-implementation: edwin, bac
    Target release: 10.06

Hide email addresses on unactivated profile page
-------------------------------------------------

https://launchpad.net/~simmo shows an email address to anonymous users. No
email address should be visible.

This was caused by the separation of SSO from Lp. The address was activated
via ubuntu's SSO. The fix is to remove the email address block from the
section that shows non-active profiles.

Rules
-----

Why is there no story for what can be seen or done with an unclaimed profile?
Annotate implies the email address is there for Admins, but the permission
is not Admin.

    * Add a story that explains what any user can see about an unclaimed
      profile.
    * Add a story that explains admins can see email address that belong
      to profiles that have been activated via SSO.
    * Update the template to restrict the email address to launchpad.Admin
    * Remove the redundant block to edit the email address...it is already
      next to the email address.

QA
--

    * Visit https://launchpad.net/~simmo
    * Verify his email address is not visible.

Lint
----

Linting changed files:
  lib/lp/registry/stories/person/xx-person-home.txt
  lib/lp/registry/templates/person-index.pt

Test
----

    * lib/lp/registry/stories/person/xx-person-home.txt
      * Add a story that explains what any user can see about an unclaimed
        profile.
      * Add a story that explains admins can see email address that belong
        to profiles that have been activated via SSO.

Implementation
--------------

    * lib/lp/registry/templates/person-index.pt
      * Change the permission to launchpad.Admin and move it to the start
        of the email block
      * Removed the redundant paragraph for editing the email address.
      * Fixed the indentation of claim team.

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

Curtis,

Thanks for the quick turn-around on this bug and for the nice test coverage.

Please s/launchpad/Launchpad in your test narrative.

Also, you demonstrate that an anonymous user cannot see the email address but that an admin can. I think it is important to show what a regular user sees (or doesn't).

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

On Fri, 2010-06-18 at 18:15 +0000, Brad Crittenden wrote:
> Review: Approve code
> Curtis,
>
> Thanks for the quick turn-around on this bug and for the nice test coverage.
>
> Please s/launchpad/Launchpad in your test narrative.
>
> Also, you demonstrate that an anonymous user cannot see the email
> address but that an admin can. I think it is important to show what a
> regular user sees (or doesn't).

Easily done.

    >>> user_browser.open('https://launchpad.dev/~jvprat')
    >>> print find_tag_by_id(user_browser.contents, 'email-addresses')
    None

Test passed as I expected. If the template permissions are lost, this
will fail.

--
__Curtis C. Hovey_________
http://launchpad.net/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/stories/person/xx-person-home.txt'
2--- lib/lp/registry/stories/person/xx-person-home.txt 2010-06-11 21:54:08 +0000
3+++ lib/lp/registry/stories/person/xx-person-home.txt 2010-06-18 23:27:31 +0000
4@@ -232,3 +232,50 @@
5 >>> anon_browser.open('http://launchpad.dev/~ubuntu-team')
6 >>> print find_tag_by_id(anon_browser.contents, 'contributions')
7 None
8+
9+
10+Unactivated profiles
11+--------------------
12+
13+Many profiles are created for users who contributed to projects that were
14+imported into Launchpad. Any user can see an unclaimed profile and a link
15+to request a claim the profile.
16+
17+ >>> anon_browser.open('https://launchpad.dev/~jvprat')
18+ >>> print anon_browser.title
19+ Jordi Vilalta does not use Launchpad
20+
21+ >>> print extract_text(find_main_content(anon_browser.contents))
22+ Jordi Vilalta does not use Launchpad. This page was created on ...
23+ when importing the Catalan (ca) translation of pmount in Ubuntu Hoary...
24+
25+ >>> anon_browser.getLink('Are you Jordi Vilalta')
26+ <Link text='Are you Jordi Vilalta?' url='.../people/+requestmerge...'>
27+
28+It is possible for the preferred email address to be set if it is associated
29+with an Ubuntu Single Signon account. Anonymous and logged in users cannot
30+see this, but admins like Foo Bar can.
31+
32+ >>> from zope.component import getUtility
33+ >>> from canonical.launchpad.interfaces.emailaddress import (
34+ ... EmailAddressStatus, IEmailAddressSet)
35+
36+ >>> login('admin@canonical.com')
37+ >>> address = getUtility(IEmailAddressSet).getByEmail('jvprat@wanadoo.es')
38+ >>> address.status = EmailAddressStatus.PREFERRED
39+ >>> transaction.commit()
40+ >>> logout()
41+
42+ >>> anon_browser.open('https://launchpad.dev/~jvprat')
43+ >>> print find_tag_by_id(anon_browser.contents, 'email-addresses')
44+ None
45+
46+ >>> user_browser.open('https://launchpad.dev/~jvprat')
47+ >>> print find_tag_by_id(user_browser.contents, 'email-addresses')
48+ None
49+
50+ >>> admin_browser.open('https://launchpad.dev/~jvprat')
51+ >>> print extract_text(
52+ ... find_tag_by_id(admin_browser.contents, 'email-addresses'))
53+ jvprat@wanadoo.es
54+ Change e-mail settings
55
56=== modified file 'lib/lp/registry/stories/person/xx-set-preferredemail.txt'
57--- lib/lp/registry/stories/person/xx-set-preferredemail.txt 2009-09-18 15:24:30 +0000
58+++ lib/lp/registry/stories/person/xx-set-preferredemail.txt 2010-06-18 23:27:31 +0000
59@@ -62,17 +62,3 @@
60 >>> for msg in get_feedback_messages(second_browser.contents):
61 ... print msg
62 testing@canonical.com is already set as your contact address.
63-
64-
65-Unclaimed users
66-===============
67-
68-An unclaimed user will probably have no contact email address.
69-
70- >>> admin_browser.open('http://launchpad.dev/~matsubara')
71- >>> print admin_browser.title
72- Diogo Matsubara does not use Launchpad
73- >>> admin_browser.getLink('Change e-mail settings').click()
74- >>> print find_tag_by_id(admin_browser.contents,
75- ... 'no-contact-address').string
76- Currently you don't have a contact address in Launchpad.
77
78=== modified file 'lib/lp/registry/templates/person-index.pt'
79--- lib/lp/registry/templates/person-index.pt 2010-04-15 22:42:41 +0000
80+++ lib/lp/registry/templates/person-index.pt 2010-06-18 23:27:31 +0000
81@@ -157,8 +157,10 @@
82 </tal:block>
83 </p>
84
85- <tal:person condition="not: view/context_is_probably_a_team">
86- <ul tal:condition="context/preferredemail">
87+ <tal:person condition="not: view/context_is_probably_a_team">
88+ <tal:admin tal:condition="context/required:launchpad.Admin">
89+ <ul id="email-addresses"
90+ tal:condition="context/preferredemail">
91 <li>
92 <img src="/@@/private" alt=""
93 tal:condition="view/email_address_visibility/are_allowed"/>
94@@ -169,19 +171,18 @@
95 <a tal:replace="structure overview_menu/editemailaddresses/fmt:icon" />
96 </li>
97 </ul>
98- <tal:editable tal:condition="context/required:launchpad.Edit">
99- <p tal:condition="not: context/preferredemail">
100- <tal:editemailaddresses
101- replace="structure overview_menu/editemailaddresses/fmt:link-icon" />
102- </p>
103- </tal:editable>
104+ </tal:admin>
105+
106+ <p>
107 <a tal:attributes="
108 href string:/people/+requestmerge?field.dupe_person=${context/name}"
109- >Are you <span tal:replace="context/displayname" />?</a>
110- </tal:person>
111- <tal:team condition="view/context_is_probably_a_team">
112- <a href="+claimteam">Is this a team you run?</a>
113- </tal:team>
114+ >Are you <span tal:replace="context/displayname" />?</a>
115+ </p>
116+ </tal:person>
117+
118+ <tal:team condition="view/context_is_probably_a_team">
119+ <a href="+claimteam">Is this a team you run?</a>
120+ </tal:team>
121 </tal:noaccount>
122
123 <tal:deactivated-account