Merge lp:~jml/launchpad/reported-by-me-121646 into lp:launchpad

Proposed by Jonathan Lange
Status: Merged
Approved by: Jonathan Lange
Approved revision: no longer in the source branch.
Merged at revision: 12678
Proposed branch: lp:~jml/launchpad/reported-by-me-121646
Merge into: lp:launchpad
Diff against target: 236 lines (+52/-12)
3 files modified
lib/lp/bugs/browser/bugtask.py (+19/-2)
lib/lp/bugs/stories/xx-bugs-statistics-portlet.txt (+22/-10)
lib/lp/bugs/templates/bugtarget-portlet-bugfilters-content.pt (+11/-0)
To merge this branch: bzr merge lp:~jml/launchpad/reported-by-me-121646
Reviewer Review Type Date Requested Status
j.c.sackett (community) Approve
Review via email: mp+51148@code.launchpad.net

Commit message

[r=jcsackett][bug=121646] Add a "Reported by me" link to the bug count portlet.

Description of the change

Braindead fix for bug 121646 - have a link to bugs reported by me. Ignores the "affects me" feature for now, makes no attempt to clean up tech debt in this area, and doesn't actually add unit tests.

But hey, it works.

To post a comment you must log in.
Revision history for this message
j.c.sackett (jcsackett) wrote :

This looks good to land.

review: Approve
Revision history for this message
Robert Collins (lifeless) wrote :

This will probably need to be rolled back if its been landed. Its
adding a query which is already timing out in the user context on a
regular basis to a portlet which is often right on the edge of timing
out.

Adding a link to a search is fine, adding the count for the result of
the search will require substantially more work.

Revision history for this message
Jonathan Lange (jml) wrote :

Rob tells me that this has since changed and that this is OK to land.

Revision history for this message
Robert Collins (lifeless) wrote :

Specifically, we've made massive improvements to the portal and its
less likely to cause a timeout regression. As usual, it will need
checking on qastaging :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/browser/bugtask.py'
2--- lib/lp/bugs/browser/bugtask.py 2011-03-07 02:50:50 +0000
3+++ lib/lp/bugs/browser/bugtask.py 2011-03-10 17:19:18 +0000
4@@ -49,7 +49,6 @@
5 timedelta,
6 )
7 from itertools import (
8- chain,
9 groupby,
10 )
11 from math import (
12@@ -1877,6 +1876,13 @@
13 else:
14 return get_buglisting_search_filter_url(assignee=self.user.name)
15
16+ @property
17+ def my_reported_bugs_url(self):
18+ """A URL to a list of bugs reported by the user, or None."""
19+ if self.user is None:
20+ return None
21+ return get_buglisting_search_filter_url(bug_reporter=self.user.name)
22+
23
24 class BugsStatsMixin(BugsInfoMixin):
25 """Contains properties giving bug stats.
26@@ -1965,6 +1971,15 @@
27 return self.context.searchTasks(params).count()
28
29 @property
30+ def my_reported_bugs_count(self):
31+ """A count of bugs reported by the user, or None."""
32+ if self.user is None:
33+ return None
34+ params = get_default_search_params(self.user)
35+ params.bug_reporter = self.user
36+ return self.context.searchTasks(params).count()
37+
38+ @property
39 def bugs_with_patches_count(self):
40 """A count of unresolved bugs with patches."""
41 return self.context.searchTasks(
42@@ -1983,7 +1998,7 @@
43
44 def get_buglisting_search_filter_url(
45 assignee=None, importance=None, status=None, status_upstream=None,
46- has_patches=None):
47+ has_patches=None, bug_reporter=None):
48 """Return the given URL with the search parameters specified."""
49 search_params = []
50
51@@ -1997,6 +2012,8 @@
52 search_params.append(('field.status_upstream', status_upstream))
53 if has_patches is not None:
54 search_params.append(('field.has_patch', 'on'))
55+ if bug_reporter is not None:
56+ search_params.append(('field.bug_reporter', bug_reporter))
57
58 query_string = urllib.urlencode(search_params, doseq=True)
59
60
61=== modified file 'lib/lp/bugs/stories/xx-bugs-statistics-portlet.txt'
62--- lib/lp/bugs/stories/xx-bugs-statistics-portlet.txt 2010-04-16 12:40:34 +0000
63+++ lib/lp/bugs/stories/xx-bugs-statistics-portlet.txt 2011-03-10 17:19:18 +0000
64@@ -40,8 +40,8 @@
65 0 Bugs fixed elsewhere
66 2 Open CVE bugs - CVE reports
67
68-Once the user has identified him or herself, information on assigned
69-bugs is also shown.
70+Once the user has identified themselves, show information on assigned and
71+reported bugs.
72
73 >>> print_bugfilters_portlet_unfilled(user_browser, path)
74 New bugs
75@@ -51,6 +51,7 @@
76 High importance bugs
77 <BLANKLINE>
78 Bugs assigned to me
79+ Bugs reported by me
80 Bugs with patches
81 Bugs fixed elsewhere
82 Open CVE bugs - CVE reports
83@@ -65,6 +66,7 @@
84 0 High importance bugs
85 <BLANKLINE>
86 0 Bugs assigned to me
87+ 0 Bugs reported by me
88 0 Bugs with patches
89 0 Bugs fixed elsewhere
90 2 Open CVE bugs - CVE reports
91@@ -108,8 +110,8 @@
92 0 Bugs fixed elsewhere
93 1 Open CVE bug - CVE report
94
95-Once the user has identified him or herself, information on assigned
96-bugs is also shown.
97+Once the user has identified themselves, show information on assigned and
98+reported bugs.
99
100 >>> print_bugfilters_portlet_unfilled(user_browser, path)
101 New bugs
102@@ -119,6 +121,7 @@
103 High importance bugs
104 <BLANKLINE>
105 Bugs assigned to me
106+ Bugs reported by me
107 Bugs with patches
108 Bugs fixed elsewhere
109 Open CVE bugs - CVE reports
110@@ -135,6 +138,7 @@
111 0 High importance bugs
112 <BLANKLINE>
113 0 Bugs assigned to me
114+ 0 Bugs reported by me
115 0 Bugs with patches
116 0 Bugs fixed elsewhere
117 1 Open CVE bug - CVE report
118@@ -175,8 +179,8 @@
119 0 Bugs fixed elsewhere
120 2 Open CVE bugs
121
122-Once the user has identified him or herself, information on assigned
123-bugs is also shown.
124+Once the user has identified themselves, show information on assigned and
125+reported bugs.
126
127 >>> print_bugfilters_portlet_unfilled(user_browser, path)
128 New bugs
129@@ -186,6 +190,7 @@
130 High importance bugs
131 <BLANKLINE>
132 Bugs assigned to me
133+ Bugs reported by me
134 Bugs with patches
135 Bugs fixed elsewhere
136 Open CVE bugs
137@@ -200,6 +205,7 @@
138 0 High importance bugs
139 <BLANKLINE>
140 0 Bugs assigned to me
141+ 0 Bugs reported by me
142 0 Bugs with patches
143 0 Bugs fixed elsewhere
144 2 Open CVE bugs
145@@ -242,8 +248,8 @@
146 0 Bugs fixed elsewhere
147 1 Open CVE bug
148
149-Once the user has identified him or herself, information on assigned
150-bugs is also shown.
151+Once the user has identified themselves, show information on assigned and
152+reported bugs.
153
154 >>> print_bugfilters_portlet_unfilled(user_browser, path)
155 New bugs
156@@ -253,6 +259,7 @@
157 High importance bugs
158 <BLANKLINE>
159 Bugs assigned to me
160+ Bugs reported by me
161 Bugs with patches
162 Bugs fixed elsewhere
163 Open CVE bugs
164@@ -265,6 +272,7 @@
165 0 High importance bugs
166 <BLANKLINE>
167 0 Bugs assigned to me
168+ 0 Bugs reported by me
169 0 Bugs with patches
170 0 Bugs fixed elsewhere
171 1 Open CVE bug
172@@ -308,8 +316,8 @@
173 0 Bugs fixed elsewhere
174 1 Open CVE bug
175
176-Once the user has identified him or herself, information on assigned
177-bugs is also shown.
178+Once the user has identified themselves, show information on assigned
179+and reported bugs.
180
181 >>> print_bugfilters_portlet_unfilled(user_browser, path)
182 New bugs
183@@ -319,6 +327,7 @@
184 High importance bugs
185 <BLANKLINE>
186 Bugs assigned to me
187+ Bugs reported by me
188 Bugs with patches
189 Bugs fixed elsewhere
190 Open CVE bugs
191@@ -333,6 +342,7 @@
192 0 High importance bugs
193 <BLANKLINE>
194 0 Bugs assigned to me
195+ 0 Bugs reported by me
196 0 Bugs with patches
197 0 Bugs fixed elsewhere
198 1 Open CVE bug
199@@ -387,6 +397,7 @@
200 High importance bugs
201 <BLANKLINE>
202 Bugs assigned to me
203+ Bugs reported by me
204 Bugs with patches
205 Bugs fixed elsewhere
206 Open CVE bugs - CVE reports
207@@ -401,6 +412,7 @@
208 0 High importance bugs
209 <BLANKLINE>
210 0 Bugs assigned to me
211+ 0 Bugs reported by me
212 0 Bugs with patches
213 0 Bugs fixed elsewhere
214 1 Open CVE bug - CVE report
215
216=== modified file 'lib/lp/bugs/templates/bugtarget-portlet-bugfilters-content.pt'
217--- lib/lp/bugs/templates/bugtarget-portlet-bugfilters-content.pt 2010-04-14 18:43:21 +0000
218+++ lib/lp/bugs/templates/bugtarget-portlet-bugfilters-content.pt 2011-03-10 17:19:18 +0000
219@@ -83,6 +83,17 @@
220 </a>
221 </td>
222 </tr>
223+ <tr tal:condition="view/user"
224+ tal:define="count view/my_reported_bugs_count|nothing;
225+ plural string: Bugs reported by me;
226+ singular string: Bug reported by me;">
227+ <td class="bugs-count" tal:content="count" />
228+ <td class="bugs-link">
229+ <a tal:attributes="href string:${view/my_reported_bugs_url}">
230+ <metal:message use-macro="context/@@+base-layout-macros/plural-message"/>
231+ </a>
232+ </td>
233+ </tr>
234 <tr tal:define="count view/bugs_with_patches_count|nothing;
235 plural string: Bugs with patches;
236 singular string: Bug with a patch;">