Expose the history of all reviewers ever on a change
For the purpose of deleting a draft patch-set and all of its comments, we need a list of every user who has ever been a reviewer on that change because those are all the users who could possibly have a draft comment on this change. With this information, we will be able to scan the draft refs for all those users to ensure that we delete every comment for this draft patch-set. Change-Id: I86a8c5242d62991c3c885911f37438e4f422b0da
This commit is contained in:
@@ -160,6 +160,7 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
|
||||
private final Map<PatchSet.Id,
|
||||
Table<Account.Id, String, Optional<PatchSetApproval>>> approvals;
|
||||
private final Map<Account.Id, ReviewerState> reviewers;
|
||||
private final List<Account.Id> allPastReviewers;
|
||||
private final List<SubmitRecord> submitRecords;
|
||||
private final Multimap<PatchSet.Id, ChangeMessage> changeMessages;
|
||||
private final Multimap<Id, PatchLineComment> commentsForPs;
|
||||
@@ -176,6 +177,7 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
|
||||
this.repo = repoManager.openRepository(getProjectName(change));
|
||||
approvals = Maps.newHashMap();
|
||||
reviewers = Maps.newLinkedHashMap();
|
||||
allPastReviewers = Lists.newArrayList();
|
||||
submitRecords = Lists.newArrayListWithExpectedSize(1);
|
||||
changeMessages = LinkedListMultimap.create();
|
||||
commentsForPs = ArrayListMultimap.create();
|
||||
@@ -188,6 +190,7 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
|
||||
parse(commit);
|
||||
}
|
||||
parseComments();
|
||||
allPastReviewers.addAll(reviewers.keySet());
|
||||
pruneReviewers();
|
||||
}
|
||||
|
||||
@@ -493,6 +496,7 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
|
||||
private final Change change;
|
||||
private ImmutableListMultimap<PatchSet.Id, PatchSetApproval> approvals;
|
||||
private ImmutableSetMultimap<ReviewerState, Account.Id> reviewers;
|
||||
private ImmutableList<Account.Id> allPastReviewers;
|
||||
private ImmutableList<SubmitRecord> submitRecords;
|
||||
private ImmutableListMultimap<PatchSet.Id, ChangeMessage> changeMessages;
|
||||
private ImmutableListMultimap<PatchSet.Id, PatchLineComment> commentsForBase;
|
||||
@@ -523,6 +527,13 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
|
||||
return reviewers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a list of all users who have ever been a reviewer on this change.
|
||||
*/
|
||||
public ImmutableList<Account.Id> getAllPastReviewers() {
|
||||
return allPastReviewers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return submit records stored during the most recent submit; only for
|
||||
* changes that were actually submitted.
|
||||
@@ -636,6 +647,7 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
|
||||
reviewers.put(e.getValue(), e.getKey());
|
||||
}
|
||||
this.reviewers = reviewers.build();
|
||||
this.allPastReviewers = ImmutableList.copyOf(parser.allPastReviewers);
|
||||
|
||||
submitRecords = ImmutableList.copyOf(parser.submitRecords);
|
||||
} catch (ParseException e1) {
|
||||
|
Reference in New Issue
Block a user