← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:fix-registry-can-delete-branch into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:fix-registry-can-delete-branch into launchpad:master.

Commit message:
Fix BranchDeletionView's checks on deletion requirements

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/434634

The recent work to allow registry experts to delete branches involved changing the permission for deleting branches from `launchpad.Edit` to `launchpad.Moderate`.  That work also changed `BranchDeletionView.display_deletion_requirements` to check for the `launchpad.Moderate` permission on deletion requirements (other objects that may need to be altered or deleted in order for the branch deletion to proceed).  However, those other objects are always of other types (e.g. merge proposals or recipes), and so that part of the change was incorrect: we should still check `launchpad.Edit` here.

Fixes a test failure in `lib/lp/code/stories/branches/xx-branch-deletion.rst`.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-registry-can-delete-branch into launchpad:master.
diff --git a/lib/lp/code/browser/branch.py b/lib/lp/code/browser/branch.py
index 0645172..0b4add6 100644
--- a/lib/lp/code/browser/branch.py
+++ b/lib/lp/code/browser/branch.py
@@ -983,7 +983,7 @@ class BranchDeletionView(LaunchpadFormView):
         for item, (operation, reason) in self.context.deletionRequirements(
             eager_load=True
         ).items():
-            allowed = check_permission("launchpad.Moderate", item)
+            allowed = check_permission("launchpad.Edit", item)
             reqs.append((item, operation, reason, allowed))
         return reqs