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

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 66c755bc2d759de01f94926733f70ec584bcbdad
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:fix-registry-can-delete-branch
Merge into: launchpad:master
Diff against target: 12 lines (+1/-1)
1 file modified
lib/lp/code/browser/branch.py (+1/-1)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+434634@code.launchpad.net

Commit message

Fix BranchDeletionView's checks on deletion requirements

Description of the change

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`.

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/code/browser/branch.py b/lib/lp/code/browser/branch.py
2index 0645172..0b4add6 100644
3--- a/lib/lp/code/browser/branch.py
4+++ b/lib/lp/code/browser/branch.py
5@@ -983,7 +983,7 @@ class BranchDeletionView(LaunchpadFormView):
6 for item, (operation, reason) in self.context.deletionRequirements(
7 eager_load=True
8 ).items():
9- allowed = check_permission("launchpad.Moderate", item)
10+ allowed = check_permission("launchpad.Edit", item)
11 reqs.append((item, operation, reason, allowed))
12 return reqs
13

Subscribers

People subscribed via source and target branches

to status/vote changes: