Merge lp:~bac/launchpad/bug-671539 into lp:launchpad

Proposed by Brad Crittenden
Status: Merged
Approved by: Brad Crittenden
Approved revision: no longer in the source branch.
Merged at revision: 11885
Proposed branch: lp:~bac/launchpad/bug-671539
Merge into: lp:launchpad
Diff against target: 143 lines (+35/-22)
3 files modified
lib/lp/code/browser/branchlisting.py (+3/-1)
lib/lp/code/stories/branches/xx-person-branches.txt (+24/-7)
lib/lp/code/templates/person-codesummary.pt (+8/-14)
To merge this branch: bzr merge lp:~bac/launchpad/bug-671539
Reviewer Review Type Date Requested Status
Jeroen T. Vermeulen (community) code Approve
Review via email: mp+40309@code.launchpad.net

Commit message

Don't show 'registered branches' on a team's code page.

Description of the change

= Summary =

Don't show the number of branches registered by teams as it is nonsense.

== Proposed fix ==

Make the link disabled if the person is a team and make the template be
conditional based on the enabled property.

Also removed some extraneous conditions in the page template. Note at
the top 'menu' is used in a condition so it cannot be unset in the body
of the template.

Also changed the class on the <td>s for consistency of count alignment.

== Pre-implementation notes ==

None

== Implementation details ==

As above.

== Tests ==

bin/test -vvm lp.code xx-person-branches.txt

== Demo and Q/A ==

Look at https://launchpad.dev/~landscape-developers and
http://launchpad.net/~launchpad to see that the line is not displayed.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/code/stories/branches/xx-person-branches.txt
  lib/lp/code/templates/person-codesummary.pt
  lib/lp/code/browser/branchlisting.py

To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Nice change. The only note I had for the code was that instead of saying

if not person.is_team:
    enabled = True
else:
    enabled = False

...(..., enabled=enabled)

it would probably be clearer to say

owner_is_individual = (not person.is_team)
...(..., enabled=owner_is_individual)

I'm not entirely sure the underlining of that section of the story test should be "=" as opposed to "-," but since I don't like rest-style headings at all I'm probably talking nonsense.

Anyway: Approved, and keep 'em coming. :-)

Jeroen

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/browser/branchlisting.py'
2--- lib/lp/code/browser/branchlisting.py 2010-10-27 08:51:05 +0000
3+++ lib/lp/code/browser/branchlisting.py 2010-11-08 10:46:12 +0000
4@@ -914,11 +914,13 @@
5 self.owned_branch_count, 'owned branch', 'owned branches'))
6
7 def registered(self):
8+ person_is_individual = (not self.person.is_team)
9 return Link(
10 '+registeredbranches',
11 get_plural_text(
12 self.registered_branch_count,
13- 'registered branch', 'registered branches'))
14+ 'registered branch', 'registered branches'),
15+ enabled=person_is_individual)
16
17 def subscribed(self):
18 return Link(
19
20=== modified file 'lib/lp/code/stories/branches/xx-person-branches.txt'
21--- lib/lp/code/stories/branches/xx-person-branches.txt 2010-10-18 20:59:08 +0000
22+++ lib/lp/code/stories/branches/xx-person-branches.txt 2010-11-08 10:46:12 +0000
23@@ -1,4 +1,3 @@
24-============================
25 Person Views of Branch Lists
26 ============================
27
28@@ -19,7 +18,7 @@
29
30
31 Default view for a person on code root site
32-===========================================
33+-------------------------------------------
34
35 The default view for a person on the code root site is the normal branch
36 listing view for that person.
37@@ -34,7 +33,7 @@
38
39
40 Junk branches
41-=============
42+-------------
43
44 On the user's own code page, they will see directions on pushing a branch.
45
46@@ -47,7 +46,7 @@
47
48
49 Owned Branches
50-==============
51+--------------
52
53 A person's owned branches are shown on their code application overview page.
54
55@@ -60,7 +59,7 @@
56
57
58 Registered Branches
59-===================
60+-------------------
61
62 There is also a link which points to the registered branches page.
63
64@@ -76,7 +75,7 @@
65
66
67 Subscribed branches
68-===================
69+-------------------
70
71 From the persons main listing page, there is also a link to subscribed
72 branches.
73@@ -93,7 +92,7 @@
74
75
76 Person branch summary
77-=====================
78+---------------------
79
80 Each of the person branch listing pages has a brief summary at the
81 top of the page with some branch counts. These also contain the links
82@@ -132,3 +131,21 @@
83 2 registered branches
84 1 subscribed branch
85 0 active reviews
86+
87+
88+Teams do not show registered branches
89+-------------------------------------
90+
91+For a team, showing registered branches does not make sense, so that
92+line is omitted.
93+
94+ >>> browser.open('http://code.launchpad.dev/~landscape-developers')
95+ >>> print_tag_with_id(
96+ ... browser.contents, 'portlet-person-codesummary')
97+ 1 owned branch
98+ 2 subscribed branches
99+ 0 active reviews
100+
101+ >>> browser.getLink('registered').click()
102+ Traceback (most recent call last):
103+ LinkNotFoundError
104
105=== modified file 'lib/lp/code/templates/person-codesummary.pt'
106--- lib/lp/code/templates/person-codesummary.pt 2010-10-15 01:48:05 +0000
107+++ lib/lp/code/templates/person-codesummary.pt 2010-11-08 10:46:12 +0000
108@@ -10,27 +10,21 @@
109 <table>
110 <tr class="code-links">
111 <td class="code-count" tal:content="menu/owned_branch_count">100</td>
112- <td tal:condition="menu"
113- tal:content="structure menu/owned/render"
114+ <td tal:content="structure menu/owned/render"
115 />
116 </tr>
117- <tr>
118+ <tr class="code-links"
119+ tal:condition="menu/registered/enabled">
120 <td class="code-count" tal:content="menu/registered_branch_count">100</td>
121- <td tal:condition="menu"
122- tal:content="structure menu/registered/render"
123- />
124+ <td tal:content="structure menu/registered/render" />
125 </tr>
126- <tr>
127+ <tr class="code-links">
128 <td class="code-count" tal:content="menu/subscribed_branch_count">100</td>
129- <td tal:condition="menu"
130- tal:content="structure menu/subscribed/render"
131- />
132+ <td tal:content="structure menu/subscribed/render" />
133 </tr>
134- <tr id="merge-counts">
135+ <tr class="code-links" id="merge-counts">
136 <td class="code-count" tal:content="menu/active_review_count">5</td>
137- <td tal:condition="menu"
138- tal:content="structure menu/active_reviews/render"
139- />
140+ <td tal:content="structure menu/active_reviews/render" />
141 </tr>
142 </table>
143 </div>