Merge lp:~intellectronica/launchpad/search-for-bugs-affecting-me into lp:launchpad

Proposed by Eleanor Berger
Status: Merged
Approved by: Deryck Hodge
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~intellectronica/launchpad/search-for-bugs-affecting-me
Merge into: lp:launchpad
Diff against target: 114 lines (+35/-4)
5 files modified
lib/lp/bugs/doc/bugtask-search.txt (+15/-0)
lib/lp/bugs/interfaces/bugtask.py (+7/-3)
lib/lp/bugs/model/bugtarget.py (+1/-1)
lib/lp/bugs/model/bugtask.py (+2/-0)
lib/lp/bugs/templates/bugtask-macros-tableview.pt (+10/-0)
To merge this branch: bzr merge lp:~intellectronica/launchpad/search-for-bugs-affecting-me
Reviewer Review Type Date Requested Status
Deryck Hodge (community) code Approve
Review via email: mp+17827@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Eleanor Berger (intellectronica) wrote :

This branch adds a new parameter to bug searches, allowing the user to limit the results to bugs marked as affecting them.

Revision history for this message
Deryck Hodge (deryck) wrote :

Looks good to me. As mentioned at the sprint, I think we need something to clarify what you're doing with the reduce statement, just so its easy to scan the test and get what's going on. It wasn't obvious to me on first glance.

Otherwise, well done. Thanks!

Cheers,
deryck

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

FWIW, I think that the builtin 'all' does exactly what that reduce statement does.

Revision history for this message
Eleanor Berger (intellectronica) wrote :

Duh, it does! I'll change that after the rollout.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/doc/bugtask-search.txt'
2--- lib/lp/bugs/doc/bugtask-search.txt 2009-07-01 13:16:44 +0000
3+++ lib/lp/bugs/doc/bugtask-search.txt 2010-01-21 17:41:19 +0000
4@@ -950,6 +950,21 @@
5 >>> ubuntu.searchTasks(search_params).count()
6 0
7
8+== Searching for bugs affecting me ==
9+
10+The user searching for bugs can search for bugs affecting him.
11+
12+We search for bugs affecting foo_bar, then check that all the results
13+return True for isUserAffected(foo_bar).
14+
15+ >>> search_params = BugTaskSearchParams(
16+ ... user=foo_bar, affects_me=True)
17+ >>> print reduce(
18+ ... lambda x, y: x and y,
19+ ... [task.bug.isUserAffected(foo_bar)
20+ ... for task in firefox.searchTasks(search_params)])
21+ True
22+
23
24 == Ordering search results ==
25
26
27=== modified file 'lib/lp/bugs/interfaces/bugtask.py'
28--- lib/lp/bugs/interfaces/bugtask.py 2009-08-25 13:51:39 +0000
29+++ lib/lp/bugs/interfaces/bugtask.py 2010-01-21 17:41:19 +0000
30@@ -788,6 +788,8 @@
31 subscriber = Choice(
32 title=_('Bug subscriber'), vocabulary='ValidPersonOrTeam',
33 required=False)
34+ affects_me = Bool(
35+ title=_('Show only bugs affecting me'), required=False)
36
37
38 class IBugTaskSearch(IBugTaskSearchBase):
39@@ -966,8 +968,8 @@
40 resolved_upstream=False, open_upstream=False,
41 has_no_upstream_bugtask=False, tag=None, has_cve=False,
42 bug_supervisor=None, bug_reporter=None, nominated_for=None,
43- bug_commenter=None, omit_targeted=False,
44- date_closed=None, affected_user=None, hardware_bus=None,
45+ bug_commenter=None, omit_targeted=False, date_closed=None,
46+ affected_user=None, affects_me=False, hardware_bus=None,
47 hardware_vendor_id=None, hardware_product_id=None,
48 hardware_driver_name=None, hardware_driver_package_name=None,
49 hardware_owner_is_bug_reporter=None,
50@@ -1005,6 +1007,7 @@
51 self.bug_commenter = bug_commenter
52 self.date_closed = date_closed
53 self.affected_user = affected_user
54+ self.affects_me = affects_me
55 self.hardware_bus = hardware_bus
56 self.hardware_vendor_id = hardware_vendor_id
57 self.hardware_product_id = hardware_product_id
58@@ -1074,7 +1077,8 @@
59 importance=None,
60 assignee=None, bug_reporter=None, bug_supervisor=None,
61 bug_commenter=None, bug_subscriber=None, owner=None,
62- affected_user=None, has_patch=None, has_cve=None,
63+ affected_user=None, affects_me=False,
64+ has_patch=None, has_cve=None,
65 distribution=None, tags=None,
66 tags_combinator=BugTagsSearchCombinator.ALL,
67 omit_duplicates=True, omit_targeted=None,
68
69=== modified file 'lib/lp/bugs/model/bugtarget.py'
70--- lib/lp/bugs/model/bugtarget.py 2009-08-18 11:14:07 +0000
71+++ lib/lp/bugs/model/bugtarget.py 2010-01-21 17:41:19 +0000
72@@ -44,7 +44,7 @@
73 importance=None,
74 assignee=None, bug_reporter=None, bug_supervisor=None,
75 bug_commenter=None, bug_subscriber=None, owner=None,
76- affected_user=None,
77+ affected_user=None, affects_me=False,
78 has_patch=None, has_cve=None, distribution=None,
79 tags=None, tags_combinator=BugTagsSearchCombinator.ALL,
80 omit_duplicates=True, omit_targeted=None,
81
82=== modified file 'lib/lp/bugs/model/bugtask.py'
83--- lib/lp/bugs/model/bugtask.py 2009-12-15 13:50:22 +0000
84+++ lib/lp/bugs/model/bugtask.py 2010-01-21 17:41:19 +0000
85@@ -1617,6 +1617,8 @@
86 """ % sqlvalues(bug_commenter=params.bug_commenter)
87 extra_clauses.append(bug_commenter_clause)
88
89+ if params.affects_me:
90+ params.affected_user = params.user
91 if params.affected_user:
92 affected_user_clause = """
93 BugTask.id IN (
94
95=== modified file 'lib/lp/bugs/templates/bugtask-macros-tableview.pt'
96--- lib/lp/bugs/templates/bugtask-macros-tableview.pt 2009-07-17 17:59:07 +0000
97+++ lib/lp/bugs/templates/bugtask-macros-tableview.pt 2010-01-21 17:41:19 +0000
98@@ -547,6 +547,16 @@
99 </label>
100 </td>
101 </tr>
102+ <tr>
103+ <td>
104+ </td>
105+ <td style="white-space: nowrap">
106+ <input tal:replace="structure view/widgets/affects_me" />
107+ <label tal:attributes="for view/widgets/affects_me/name">
108+ Show only bugs affecting me
109+ </label>
110+ </td>
111+ </tr>
112 <tr>
113 <tal:XXX condition="nothing">
114 # XXX: Bjorn Tillenius 2006-10-02: