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
=== modified file 'lib/lp/bugs/doc/bugtask-search.txt'
--- lib/lp/bugs/doc/bugtask-search.txt 2009-07-01 13:16:44 +0000
+++ lib/lp/bugs/doc/bugtask-search.txt 2010-01-21 17:41:19 +0000
@@ -950,6 +950,21 @@
950 >>> ubuntu.searchTasks(search_params).count()950 >>> ubuntu.searchTasks(search_params).count()
951 0951 0
952952
953== Searching for bugs affecting me ==
954
955The user searching for bugs can search for bugs affecting him.
956
957We search for bugs affecting foo_bar, then check that all the results
958return True for isUserAffected(foo_bar).
959
960 >>> search_params = BugTaskSearchParams(
961 ... user=foo_bar, affects_me=True)
962 >>> print reduce(
963 ... lambda x, y: x and y,
964 ... [task.bug.isUserAffected(foo_bar)
965 ... for task in firefox.searchTasks(search_params)])
966 True
967
953968
954== Ordering search results ==969== Ordering search results ==
955970
956971
=== modified file 'lib/lp/bugs/interfaces/bugtask.py'
--- lib/lp/bugs/interfaces/bugtask.py 2009-08-25 13:51:39 +0000
+++ lib/lp/bugs/interfaces/bugtask.py 2010-01-21 17:41:19 +0000
@@ -788,6 +788,8 @@
788 subscriber = Choice(788 subscriber = Choice(
789 title=_('Bug subscriber'), vocabulary='ValidPersonOrTeam',789 title=_('Bug subscriber'), vocabulary='ValidPersonOrTeam',
790 required=False)790 required=False)
791 affects_me = Bool(
792 title=_('Show only bugs affecting me'), required=False)
791793
792794
793class IBugTaskSearch(IBugTaskSearchBase):795class IBugTaskSearch(IBugTaskSearchBase):
@@ -966,8 +968,8 @@
966 resolved_upstream=False, open_upstream=False,968 resolved_upstream=False, open_upstream=False,
967 has_no_upstream_bugtask=False, tag=None, has_cve=False,969 has_no_upstream_bugtask=False, tag=None, has_cve=False,
968 bug_supervisor=None, bug_reporter=None, nominated_for=None,970 bug_supervisor=None, bug_reporter=None, nominated_for=None,
969 bug_commenter=None, omit_targeted=False,971 bug_commenter=None, omit_targeted=False, date_closed=None,
970 date_closed=None, affected_user=None, hardware_bus=None,972 affected_user=None, affects_me=False, hardware_bus=None,
971 hardware_vendor_id=None, hardware_product_id=None,973 hardware_vendor_id=None, hardware_product_id=None,
972 hardware_driver_name=None, hardware_driver_package_name=None,974 hardware_driver_name=None, hardware_driver_package_name=None,
973 hardware_owner_is_bug_reporter=None,975 hardware_owner_is_bug_reporter=None,
@@ -1005,6 +1007,7 @@
1005 self.bug_commenter = bug_commenter1007 self.bug_commenter = bug_commenter
1006 self.date_closed = date_closed1008 self.date_closed = date_closed
1007 self.affected_user = affected_user1009 self.affected_user = affected_user
1010 self.affects_me = affects_me
1008 self.hardware_bus = hardware_bus1011 self.hardware_bus = hardware_bus
1009 self.hardware_vendor_id = hardware_vendor_id1012 self.hardware_vendor_id = hardware_vendor_id
1010 self.hardware_product_id = hardware_product_id1013 self.hardware_product_id = hardware_product_id
@@ -1074,7 +1077,8 @@
1074 importance=None,1077 importance=None,
1075 assignee=None, bug_reporter=None, bug_supervisor=None,1078 assignee=None, bug_reporter=None, bug_supervisor=None,
1076 bug_commenter=None, bug_subscriber=None, owner=None,1079 bug_commenter=None, bug_subscriber=None, owner=None,
1077 affected_user=None, has_patch=None, has_cve=None,1080 affected_user=None, affects_me=False,
1081 has_patch=None, has_cve=None,
1078 distribution=None, tags=None,1082 distribution=None, tags=None,
1079 tags_combinator=BugTagsSearchCombinator.ALL,1083 tags_combinator=BugTagsSearchCombinator.ALL,
1080 omit_duplicates=True, omit_targeted=None,1084 omit_duplicates=True, omit_targeted=None,
10811085
=== modified file 'lib/lp/bugs/model/bugtarget.py'
--- lib/lp/bugs/model/bugtarget.py 2009-08-18 11:14:07 +0000
+++ lib/lp/bugs/model/bugtarget.py 2010-01-21 17:41:19 +0000
@@ -44,7 +44,7 @@
44 importance=None,44 importance=None,
45 assignee=None, bug_reporter=None, bug_supervisor=None,45 assignee=None, bug_reporter=None, bug_supervisor=None,
46 bug_commenter=None, bug_subscriber=None, owner=None,46 bug_commenter=None, bug_subscriber=None, owner=None,
47 affected_user=None,47 affected_user=None, affects_me=False,
48 has_patch=None, has_cve=None, distribution=None,48 has_patch=None, has_cve=None, distribution=None,
49 tags=None, tags_combinator=BugTagsSearchCombinator.ALL,49 tags=None, tags_combinator=BugTagsSearchCombinator.ALL,
50 omit_duplicates=True, omit_targeted=None,50 omit_duplicates=True, omit_targeted=None,
5151
=== modified file 'lib/lp/bugs/model/bugtask.py'
--- lib/lp/bugs/model/bugtask.py 2009-12-15 13:50:22 +0000
+++ lib/lp/bugs/model/bugtask.py 2010-01-21 17:41:19 +0000
@@ -1617,6 +1617,8 @@
1617 """ % sqlvalues(bug_commenter=params.bug_commenter)1617 """ % sqlvalues(bug_commenter=params.bug_commenter)
1618 extra_clauses.append(bug_commenter_clause)1618 extra_clauses.append(bug_commenter_clause)
16191619
1620 if params.affects_me:
1621 params.affected_user = params.user
1620 if params.affected_user:1622 if params.affected_user:
1621 affected_user_clause = """1623 affected_user_clause = """
1622 BugTask.id IN (1624 BugTask.id IN (
16231625
=== modified file 'lib/lp/bugs/templates/bugtask-macros-tableview.pt'
--- lib/lp/bugs/templates/bugtask-macros-tableview.pt 2009-07-17 17:59:07 +0000
+++ lib/lp/bugs/templates/bugtask-macros-tableview.pt 2010-01-21 17:41:19 +0000
@@ -547,6 +547,16 @@
547 </label>547 </label>
548 </td>548 </td>
549 </tr>549 </tr>
550 <tr>
551 <td>
552 </td>
553 <td style="white-space: nowrap">
554 <input tal:replace="structure view/widgets/affects_me" />
555 <label tal:attributes="for view/widgets/affects_me/name">
556 Show only bugs affecting me
557 </label>
558 </td>
559 </tr>
550 <tr>560 <tr>
551 <tal:XXX condition="nothing">561 <tal:XXX condition="nothing">
552 # XXX: Bjorn Tillenius 2006-10-02:562 # XXX: Bjorn Tillenius 2006-10-02: