Merge lp://staging/~gmb/launchpad/lp-devs-can-reset-watches into lp://staging/launchpad

Proposed by Graham Binns
Status: Merged
Approved by: Graham Binns
Approved revision: no longer in the source branch.
Merged at revision: 11462
Proposed branch: lp://staging/~gmb/launchpad/lp-devs-can-reset-watches
Merge into: lp://staging/launchpad
Diff against target: 339 lines (+212/-3)
8 files modified
lib/canonical/launchpad/security.py (+11/-0)
lib/lp/bugs/browser/bugwatch.py (+17/-0)
lib/lp/bugs/configure.zcml (+5/-2)
lib/lp/bugs/interfaces/bugwatch.py (+11/-0)
lib/lp/bugs/model/bugwatch.py (+9/-0)
lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt (+67/-0)
lib/lp/bugs/templates/bugwatch-portlet-details.pt (+1/-1)
lib/lp/bugs/tests/test_bugwatch.py (+91/-0)
To merge this branch: bzr merge lp://staging/~gmb/launchpad/lp-devs-can-reset-watches
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+33796@code.staging.launchpad.net

Commit message

A button has been added to bug watch pages to allow admins to completely reset a bug watch.

Description of the change

This branch adds a button to the BugWatch +edit page, visible to LP devs and admins. The button allows the user to completely reset the bug watch so that checkwatches treats it as a brand new watch. This is distinct from the "reschedule this watch" button, which merely re-queues the watch for updating.

I've added a new AuthorizationBase for IBugWatch, defining the people who have launchpad.Admin permission on a BugWatch as Admins and Launchpad developers.

I've added a reset() method to BugWatch and a related action to BugWatchEditView. I've added unittests for BugWatch.reset() to lp.bugs.tests.test_bugwatch and a story to cover the use of the 'Reset this watch' button.

To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) wrote :

Hi Graham,

nice work! Just one suggestion:

> === modified file 'lib/lp/bugs/browser/bugwatch.py'
> --- lib/lp/bugs/browser/bugwatch.py 2010-08-20 20:31:18 +0000
> +++ lib/lp/bugs/browser/bugwatch.py 2010-08-26 15:46:37 +0000
> @@ -25,6 +25,7 @@
> LaunchpadFormView,
> LaunchpadView,
> )
> +from canonical.launchpad.webapp.authorization import check_permission
> from canonical.launchpad.webapp.interfaces import ILaunchBag
> from canonical.launchpad.webapp.menu import structured
> from canonical.widgets.textwidgets import URIWidget
> @@ -148,6 +149,22 @@
> remote_bug=bugwatch.remotebug))
> bugwatch.bug.removeWatch(bugwatch, self.user)
>
> + def resetBugWatchCondition(self, action):
> + """Return True if the reset action can be shown to this user."""
> + return check_permission('launchpad.Admin', self.context)
> +

Perhaps I did not have enough coffee, but I think this method name could also mean "is the bug watch in a state that it could/should be reset?". What about "userCanResetBugWatch"?

review: Approve (code)
Revision history for this message
Graham Binns (gmb) wrote :

From IRC:

<gmb> adeuring, foo*Condition is the usual naming idiom for methods used to decide whether or not we can display an action. Maybe showResetActionCondition() would be clearer.
<adeuring> gmb: right, that's better!
<gmb> Right, I'll do that, then.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.