Allow loading Project Access when there is no refs/meta/config
If the project does not have refs/meta/config the revision is null. Enable loading the access screen anyway with a null revision field, and on save of any edits require the branch to be new. This is already handled by MetaDataUpdate, provided that the base revision we supply is null, so make it @Nullable inside of the ChangeProjectAccess handler. Change-Id: I4417bf802e329eb7193a7cb514f7ebcd7d68f26e
This commit is contained in:
parent
730c71903c
commit
23f2e7096c
@ -53,7 +53,8 @@ import javax.annotation.Nullable;
|
||||
class ChangeProjectAccess extends Handler<ProjectAccess> {
|
||||
interface Factory {
|
||||
ChangeProjectAccess create(@Assisted Project.NameKey projectName,
|
||||
@Assisted ObjectId base, @Assisted List<AccessSection> sectionList,
|
||||
@Nullable @Assisted ObjectId base,
|
||||
@Assisted List<AccessSection> sectionList,
|
||||
@Nullable @Assisted String message);
|
||||
}
|
||||
|
||||
@ -75,7 +76,8 @@ class ChangeProjectAccess extends Handler<ProjectAccess> {
|
||||
final MetaDataUpdate.User metaDataUpdateFactory,
|
||||
|
||||
@Assisted final Project.NameKey projectName,
|
||||
@Assisted final ObjectId base, @Assisted List<AccessSection> sectionList,
|
||||
@Nullable @Assisted final ObjectId base,
|
||||
@Assisted List<AccessSection> sectionList,
|
||||
@Nullable @Assisted String message) {
|
||||
this.projectAccessFactory = projectAccessFactory;
|
||||
this.projectControlFactory = projectControlFactory;
|
||||
|
@ -177,7 +177,10 @@ class ProjectAccessFactory extends Handler<ProjectAccess> {
|
||||
}
|
||||
|
||||
final ProjectAccess detail = new ProjectAccess();
|
||||
detail.setRevision(config.getRevision().name());
|
||||
|
||||
if (config.getRevision() != null) {
|
||||
detail.setRevision(config.getRevision().name());
|
||||
}
|
||||
|
||||
if (projectName.equals(allProjectsName)) {
|
||||
if (pc.isOwner()) {
|
||||
|
@ -85,7 +85,12 @@ class ProjectAdminServiceImpl implements ProjectAdminService {
|
||||
public void changeProjectAccess(Project.NameKey projectName,
|
||||
String baseRevision, String msg, List<AccessSection> sections,
|
||||
AsyncCallback<ProjectAccess> cb) {
|
||||
ObjectId base = ObjectId.fromString(baseRevision);
|
||||
ObjectId base;
|
||||
if (baseRevision != null && !baseRevision.isEmpty()) {
|
||||
base = ObjectId.fromString(baseRevision);
|
||||
} else {
|
||||
base = null;
|
||||
}
|
||||
changeProjectAccessFactory.create(projectName, base, sections, msg).to(cb);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user