Move Change out of AbstractChangeNotes
In order to load all draft PatchLineComments for a given author, we will need to be able to scan all the refs in their namespace of the All-Users repository and load the drafts in without access to a Change object (we will just have the ChangeId from the refname). Therefore, I removed that field from AbstractChangeNotes and put the Change object just in ChangeNotes because some callers of ChangeNotes need the Change object. I put the ChangeId in the AbstractChangeNotes instead, since both ChangeNotes and DraftCommentNotes need that. Change-Id: Icd3b72b10dd39a205c3ec420b25a6740b9d376af
This commit is contained in:
@@ -62,8 +62,8 @@ public class DraftCommentNotes extends AbstractChangeNotes<DraftCommentNotes> {
|
||||
this.draftsProject = allUsers.get();
|
||||
}
|
||||
|
||||
public DraftCommentNotes create(Change change, Account.Id accountId) {
|
||||
return new DraftCommentNotes(repoManager, draftsProject, change,
|
||||
public DraftCommentNotes create(Change.Id changeId, Account.Id accountId) {
|
||||
return new DraftCommentNotes(repoManager, draftsProject, changeId,
|
||||
accountId);
|
||||
}
|
||||
}
|
||||
@@ -79,10 +79,10 @@ public class DraftCommentNotes extends AbstractChangeNotes<DraftCommentNotes> {
|
||||
private final Multimap<PatchSet.Id, PatchLineComment> draftPsComments;
|
||||
private NoteMap noteMap;
|
||||
|
||||
private Parser(Change change, RevWalk walk, ObjectId tip,
|
||||
private Parser(Change.Id changeId, RevWalk walk, ObjectId tip,
|
||||
GitRepositoryManager repoManager, AllUsersName draftsProject,
|
||||
Account.Id author) throws RepositoryNotFoundException, IOException {
|
||||
this.changeId = change.getId();
|
||||
this.changeId = changeId;
|
||||
this.walk = walk;
|
||||
this.tip = tip;
|
||||
this.repo = repoManager.openRepository(draftsProject);
|
||||
@@ -109,8 +109,8 @@ public class DraftCommentNotes extends AbstractChangeNotes<DraftCommentNotes> {
|
||||
private NoteMap noteMap;
|
||||
|
||||
DraftCommentNotes(GitRepositoryManager repoManager,
|
||||
AllUsersName draftsProject, Change change, Account.Id author) {
|
||||
super(repoManager, change);
|
||||
AllUsersName draftsProject, Change.Id changeId, Account.Id author) {
|
||||
super(repoManager, changeId);
|
||||
this.draftsProject = draftsProject;
|
||||
this.author = author;
|
||||
|
||||
@@ -167,7 +167,7 @@ public class DraftCommentNotes extends AbstractChangeNotes<DraftCommentNotes> {
|
||||
}
|
||||
|
||||
RevWalk walk = new RevWalk(reader);
|
||||
Parser parser = new Parser(getChange(), walk, rev, repoManager,
|
||||
Parser parser = new Parser(getChangeId(), walk, rev, repoManager,
|
||||
draftsProject, author);
|
||||
parser.parseDraftComments();
|
||||
|
||||
|
Reference in New Issue
Block a user