ReviewerJson: actually use passed-in approvals
Change-Id: Ib2d6293829000023db57809ae1ebc7a1d99b542c
This commit is contained in:
@@ -241,7 +241,6 @@ public class PostReviewers implements RestModifyView<ChangeResource, AddReviewer
|
|||||||
for (PatchSetApproval psa : added) {
|
for (PatchSetApproval psa : added) {
|
||||||
result.reviewers.add(json.format(
|
result.reviewers.add(json.format(
|
||||||
new ReviewerInfo(psa.getAccountId()),
|
new ReviewerInfo(psa.getAccountId()),
|
||||||
rsrc.getNotes(),
|
|
||||||
reviewers.get(psa.getAccountId()),
|
reviewers.get(psa.getAccountId()),
|
||||||
ImmutableList.of(psa)));
|
ImmutableList.of(psa)));
|
||||||
}
|
}
|
||||||
|
@@ -67,7 +67,10 @@ public class ReviewerJson {
|
|||||||
List<ReviewerInfo> infos = Lists.newArrayListWithCapacity(rsrcs.size());
|
List<ReviewerInfo> infos = Lists.newArrayListWithCapacity(rsrcs.size());
|
||||||
AccountInfo.Loader loader = accountLoaderFactory.create(true);
|
AccountInfo.Loader loader = accountLoaderFactory.create(true);
|
||||||
for (ReviewerResource rsrc : rsrcs) {
|
for (ReviewerResource rsrc : rsrcs) {
|
||||||
ReviewerInfo info = format(rsrc, null);
|
ReviewerInfo info = format(new ReviewerInfo(
|
||||||
|
rsrc.getUser().getAccountId()),
|
||||||
|
rsrc.getUserControl(),
|
||||||
|
rsrc.getNotes());
|
||||||
loader.put(info);
|
loader.put(info);
|
||||||
infos.add(info);
|
infos.add(info);
|
||||||
}
|
}
|
||||||
@@ -79,12 +82,15 @@ public class ReviewerJson {
|
|||||||
return format(ImmutableList.<ReviewerResource> of(rsrc));
|
return format(ImmutableList.<ReviewerResource> of(rsrc));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReviewerInfo format(ReviewerInfo out, ChangeNotes changeNotes,
|
public ReviewerInfo format(ReviewerInfo out, ChangeControl ctl,
|
||||||
ChangeControl ctl, List<PatchSetApproval> approvals) throws OrmException {
|
ChangeNotes changeNotes) throws OrmException {
|
||||||
PatchSet.Id psId = ctl.getChange().currentPatchSetId();
|
PatchSet.Id psId = ctl.getChange().currentPatchSetId();
|
||||||
|
return format(out, ctl,
|
||||||
|
approvalsUtil.byPatchSetUser(db.get(), changeNotes, psId, out._id));
|
||||||
|
}
|
||||||
|
|
||||||
approvals =
|
public ReviewerInfo format(ReviewerInfo out, ChangeControl ctl,
|
||||||
approvalsUtil.byPatchSetUser(db.get(), changeNotes, psId, out._id);
|
List<PatchSetApproval> approvals) throws OrmException {
|
||||||
approvals = labelNormalizer.normalize(ctl, approvals);
|
approvals = labelNormalizer.normalize(ctl, approvals);
|
||||||
LabelTypes labelTypes = ctl.getLabelTypes();
|
LabelTypes labelTypes = ctl.getLabelTypes();
|
||||||
|
|
||||||
@@ -128,12 +134,6 @@ public class ReviewerJson {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ReviewerInfo format(ReviewerResource rsrc,
|
|
||||||
List<PatchSetApproval> approvals) throws OrmException {
|
|
||||||
return format(new ReviewerInfo(rsrc.getUser().getAccountId()),
|
|
||||||
rsrc.getNotes(), rsrc.getUserControl(), approvals);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ReviewerInfo extends AccountInfo {
|
public static class ReviewerInfo extends AccountInfo {
|
||||||
final String kind = "gerritcodereview#reviewer";
|
final String kind = "gerritcodereview#reviewer";
|
||||||
Map<String, String> approvals;
|
Map<String, String> approvals;
|
||||||
|
Reference in New Issue
Block a user