From 3d09b6e474d85df8c43713ec05b4542fab66b699 Mon Sep 17 00:00:00 2001 From: Edwin Kempin Date: Tue, 10 Nov 2015 16:15:52 -0800 Subject: [PATCH] Notedb: Add user as reviewer when posting a review with new approvals The PostReview REST endpoint allows users to put approvals onto the change. If a new approval was added the user was not recorded as reviewer in notedb. Hence the ChangeInfo.reviewed field was not set when notedb was enabled. This fixes the ChangeIT#checkReviewedFlagBeforeAndAfterReview() test that failed when notedb was enabled. Change-Id: Ia57dc1ce9701f954a0d63037d53000b4a877f4f0 Signed-off-by: Edwin Kempin --- .../main/java/com/google/gerrit/server/change/PostReview.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java index 4eb4763871..39f7bb4661 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java @@ -64,6 +64,7 @@ import com.google.gerrit.server.git.BatchUpdate.ChangeContext; import com.google.gerrit.server.git.BatchUpdate.Context; import com.google.gerrit.server.git.UpdateException; import com.google.gerrit.server.notedb.ChangeUpdate; +import com.google.gerrit.server.notedb.ReviewerState; import com.google.gerrit.server.patch.PatchListCache; import com.google.gerrit.server.project.ChangeControl; import com.google.gerrit.server.query.change.ChangeData; @@ -548,6 +549,7 @@ public class PostReview implements RestModifyView ups.add(c); addLabelDelta(normName, c.getValue()); categories.put(normName, c.getValue()); + update.putReviewer(user.getAccountId(), ReviewerState.REVIEWER); update.putApproval(ent.getKey(), ent.getValue()); } }