Use proper ChangeData method for reviewer predicates
Change-Id: Icd3b5c53a503aea9c1ca2560c2dcd3989e4a6aed
This commit is contained in:
@@ -34,8 +34,8 @@ class IsReviewedPredicate extends IndexPredicate<ChangeData> {
|
||||
}
|
||||
|
||||
PatchSet.Id current = c.currentPatchSetId();
|
||||
for (PatchSetApproval p : object.approvals().values()) {
|
||||
if (p.getPatchSetId().equals(current) && p.getValue() != 0) {
|
||||
for (PatchSetApproval p : object.approvals().get(current)) {
|
||||
if (p.getValue() != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
package com.google.gerrit.server.query.change;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.PatchSetApproval;
|
||||
import com.google.gerrit.server.index.ChangeField;
|
||||
import com.google.gerrit.server.index.IndexPredicate;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
@@ -34,8 +33,8 @@ class ReviewerPredicate extends IndexPredicate<ChangeData> {
|
||||
|
||||
@Override
|
||||
public boolean match(final ChangeData object) throws OrmException {
|
||||
for (PatchSetApproval p : object.approvals().values()) {
|
||||
if (id.equals(p.getAccountId())) {
|
||||
for (Account.Id accountId : object.reviewers().values()) {
|
||||
if (id.equals(accountId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
package com.google.gerrit.server.query.change;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
import com.google.gerrit.reviewdb.client.PatchSetApproval;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.query.OperatorPredicate;
|
||||
@@ -41,9 +41,8 @@ class ReviewerinPredicate extends OperatorPredicate<ChangeData> {
|
||||
|
||||
@Override
|
||||
public boolean match(final ChangeData object) throws OrmException {
|
||||
for (PatchSetApproval p : object.approvals().values()) {
|
||||
final IdentifiedUser reviewer = userFactory.create(dbProvider,
|
||||
p.getAccountId());
|
||||
for (Account.Id accountId : object.reviewers().values()) {
|
||||
IdentifiedUser reviewer = userFactory.create(dbProvider, accountId);
|
||||
if (reviewer.getEffectiveGroups().contains(uuid)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user