ChangeJson: Don't load all approvals on closed changes
Only current approvals come from the index, so loading all approvals requires an additional database lookup. In the case of search results, we don't need DETAILED_LABELS, so we don't need to look up all reviewers. Change-Id: Id249ee8b0fb8d900c616ad87d28cda49f84a109a
This commit is contained in:
committed by
David Pursehouse
parent
92c3fd88aa
commit
735f899c6b
@@ -595,8 +595,14 @@ public class ChangeJson {
|
||||
LabelTypes labelTypes, boolean standard, boolean detailed)
|
||||
throws OrmException {
|
||||
Set<Account.Id> allUsers = Sets.newHashSet();
|
||||
for (PatchSetApproval psa : cd.approvals().values()) {
|
||||
allUsers.add(psa.getAccountId());
|
||||
if (detailed) {
|
||||
// Users expect to see all reviewers on closed changes, even if they
|
||||
// didn't vote on the latest patch set. If we don't need detailed labels,
|
||||
// we aren't including 0 votes for all users below, so we can just look at
|
||||
// the latest patch set (in the next loop).
|
||||
for (PatchSetApproval psa : cd.approvals().values()) {
|
||||
allUsers.add(psa.getAccountId());
|
||||
}
|
||||
}
|
||||
|
||||
// We can only approximately reconstruct what the submit rule evaluator
|
||||
@@ -604,6 +610,7 @@ public class ChangeJson {
|
||||
Set<String> labelNames = Sets.newHashSet();
|
||||
Multimap<Account.Id, PatchSetApproval> current = HashMultimap.create();
|
||||
for (PatchSetApproval a : cd.currentApprovals()) {
|
||||
allUsers.add(a.getAccountId());
|
||||
LabelType type = labelTypes.byLabel(a.getLabelId());
|
||||
if (type != null) {
|
||||
labelNames.add(type.getName());
|
||||
|
||||
Reference in New Issue
Block a user