Merge "Make ChangeControl#canDelete(ReviewDb, Change.Status) private"
This commit is contained in:
@@ -135,7 +135,7 @@ public class DeleteDraftPatchSet
|
||||
if (!allowDrafts) {
|
||||
throw new MethodNotAllowedException("Draft workflow is disabled");
|
||||
}
|
||||
if (!ctx.getControl().canDelete(ctx.getDb(), Change.Status.DRAFT)) {
|
||||
if (!ctx.getControl().canDeleteDraft(ctx.getDb())) {
|
||||
throw new AuthException("Not permitted to delete this draft patch set");
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ public class DeleteDraftPatchSet
|
||||
allowDrafts
|
||||
&& rsrc.getPatchSet().isDraft()
|
||||
&& psUtil.byChange(db.get(), rsrc.getNotes()).size() > 1
|
||||
&& rsrc.getControl().canDelete(db.get(), Change.Status.DRAFT));
|
||||
&& rsrc.getControl().canDeleteDraft(db.get()));
|
||||
} catch (OrmException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
@@ -234,8 +234,14 @@ public class ChangeControl {
|
||||
return (isOwner() || getRefControl().canPublishDrafts()) && isVisible(db);
|
||||
}
|
||||
|
||||
/** Can this user delete this draft change or any patch set of this change? */
|
||||
public boolean canDeleteDraft(ReviewDb db) throws OrmException {
|
||||
// TODO(hiesel) These don't need to be migrated, just remove after support for drafts is removed
|
||||
return canDelete(db, Change.Status.DRAFT);
|
||||
}
|
||||
|
||||
/** Can this user delete this change or any patch set of this change? */
|
||||
public boolean canDelete(ReviewDb db, Change.Status status) throws OrmException {
|
||||
private boolean canDelete(ReviewDb db, Change.Status status) throws OrmException {
|
||||
if (!isVisible(db)) {
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user