Only call openMetadataRepository when notedb is enabled
This requires some slight ugliness of passing the NotesMigration down into every AbstractChangeNotes so we can short-circuit during load(). Change-Id: I96a75fc3a7aa1005006e1b70bfb5506c2a0397f4
This commit is contained in:
@@ -48,19 +48,22 @@ public class DraftCommentNotes extends AbstractChangeNotes<DraftCommentNotes> {
|
||||
@Singleton
|
||||
public static class Factory {
|
||||
private final GitRepositoryManager repoManager;
|
||||
private final NotesMigration migration;
|
||||
private final AllUsersName draftsProject;
|
||||
|
||||
@VisibleForTesting
|
||||
@Inject
|
||||
public Factory(GitRepositoryManager repoManager,
|
||||
NotesMigration migration,
|
||||
AllUsersNameProvider allUsers) {
|
||||
this.repoManager = repoManager;
|
||||
this.migration = migration;
|
||||
this.draftsProject = allUsers.get();
|
||||
}
|
||||
|
||||
public DraftCommentNotes create(Change.Id changeId, Account.Id accountId) {
|
||||
return new DraftCommentNotes(repoManager, draftsProject, changeId,
|
||||
accountId);
|
||||
return new DraftCommentNotes(repoManager, migration, draftsProject,
|
||||
changeId, accountId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,9 +74,9 @@ public class DraftCommentNotes extends AbstractChangeNotes<DraftCommentNotes> {
|
||||
private final Table<PatchSet.Id, String, PatchLineComment> draftPsComments;
|
||||
private NoteMap noteMap;
|
||||
|
||||
DraftCommentNotes(GitRepositoryManager repoManager,
|
||||
DraftCommentNotes(GitRepositoryManager repoManager, NotesMigration migration,
|
||||
AllUsersName draftsProject, Change.Id changeId, Account.Id author) {
|
||||
super(repoManager, changeId);
|
||||
super(repoManager, migration, changeId);
|
||||
this.draftsProject = draftsProject;
|
||||
this.author = author;
|
||||
|
||||
@@ -149,6 +152,11 @@ public class DraftCommentNotes extends AbstractChangeNotes<DraftCommentNotes> {
|
||||
getClass().getSimpleName() + " is read-only");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadDefaults() {
|
||||
// Do nothing; tables are final and initialized in constructor.
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Project.NameKey getProjectName() {
|
||||
return draftsProject;
|
||||
|
Reference in New Issue
Block a user