Merge "Fix visibleto change operator when multiple accounts match"

This commit is contained in:
Edwin Kempin 2019-01-24 13:30:00 +00:00 committed by Gerrit Code Review
commit 0bbd3a419c

View File

@ -14,6 +14,7 @@
package com.google.gerrit.server.query.change;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.gerrit.reviewdb.client.Change.CHANGE_ID_PATTERN;
import static com.google.gerrit.server.query.change.ChangeData.asChanges;
import static java.util.stream.Collectors.toList;
@ -913,11 +914,8 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
}
Set<Account.Id> m = args.accountResolver.findAll(who);
if (!m.isEmpty()) {
List<Predicate<ChangeData>> p = Lists.newArrayListWithCapacity(m.size());
for (Account.Id id : m) {
return visibleto(args.userFactory.create(id));
}
return Predicate.or(p);
return Predicate.or(
m.stream().map(id -> visibleto(args.userFactory.create(id))).collect(toImmutableList()));
}
// If its not an account, maybe its a group?