Add ready property to ReviewResult
This is particularly needed for transitioning PolyGerrit to use this new API. We can use this property to determine immediately upon receiving a response to posting a review whether we need to fall back to a second API call to start review. Bug: Issue 6760 Change-Id: Ib0ef5f5a0d454de4cd4b9496ab1cf81dba729a99
This commit is contained in:
@@ -6737,6 +6737,9 @@ Map of account or group identifier to
|
|||||||
link:rest-api-changes.html#add-reviewer-result[AddReviewerResult]
|
link:rest-api-changes.html#add-reviewer-result[AddReviewerResult]
|
||||||
representing the outcome of adding as a reviewer.
|
representing the outcome of adding as a reviewer.
|
||||||
Absent if no reviewer additions were requested.
|
Absent if no reviewer additions were requested.
|
||||||
|
|`ready` |optional|
|
||||||
|
If true, the change was moved from WIP to ready for review as a result of this
|
||||||
|
action. Not set if false.
|
||||||
|============================
|
|============================
|
||||||
|
|
||||||
[[reviewer-info]]
|
[[reviewer-info]]
|
||||||
|
|||||||
@@ -510,7 +510,8 @@ public class ChangeIT extends AbstractDaemonTest {
|
|||||||
assertThat(r.getChange().change().isWorkInProgress()).isTrue();
|
assertThat(r.getChange().change().isWorkInProgress()).isTrue();
|
||||||
|
|
||||||
ReviewInput in = ReviewInput.noScore().setWorkInProgress(false);
|
ReviewInput in = ReviewInput.noScore().setWorkInProgress(false);
|
||||||
gApi.changes().id(r.getChangeId()).revision("current").review(in);
|
ReviewResult result = gApi.changes().id(r.getChangeId()).revision("current").review(in);
|
||||||
|
assertThat(result.ready).isTrue();
|
||||||
|
|
||||||
ChangeInfo info = gApi.changes().id(r.getChangeId()).get();
|
ChangeInfo info = gApi.changes().id(r.getChangeId()).get();
|
||||||
assertThat(info.workInProgress).isNull();
|
assertThat(info.workInProgress).isNull();
|
||||||
@@ -523,7 +524,8 @@ public class ChangeIT extends AbstractDaemonTest {
|
|||||||
assertThat(r.getChange().change().isWorkInProgress()).isFalse();
|
assertThat(r.getChange().change().isWorkInProgress()).isFalse();
|
||||||
|
|
||||||
ReviewInput in = ReviewInput.noScore().setWorkInProgress(true);
|
ReviewInput in = ReviewInput.noScore().setWorkInProgress(true);
|
||||||
gApi.changes().id(r.getChangeId()).revision("current").review(in);
|
ReviewResult result = gApi.changes().id(r.getChangeId()).revision("current").review(in);
|
||||||
|
assertThat(result.ready).isNull();
|
||||||
|
|
||||||
ChangeInfo info = gApi.changes().id(r.getChangeId()).get();
|
ChangeInfo info = gApi.changes().id(r.getChangeId()).get();
|
||||||
assertThat(info.workInProgress).isTrue();
|
assertThat(info.workInProgress).isTrue();
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ public class ReviewResult {
|
|||||||
*/
|
*/
|
||||||
@Nullable public Map<String, AddReviewerResult> reviewers;
|
@Nullable public Map<String, AddReviewerResult> reviewers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boolean indicating whether the change was moved out of WIP by this review. Either true or null.
|
||||||
|
*/
|
||||||
|
@Nullable public Boolean ready;
|
||||||
|
|
||||||
/** Error message for non-200 responses. */
|
/** Error message for non-200 responses. */
|
||||||
@Nullable public String error;
|
@Nullable public String error;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -330,6 +330,10 @@ public class PostReview
|
|||||||
output.error = ERROR_ONLY_OWNER_CAN_MODIFY_WORK_IN_PROGRESS;
|
output.error = ERROR_ONLY_OWNER_CAN_MODIFY_WORK_IN_PROGRESS;
|
||||||
return Response.withStatusCode(SC_BAD_REQUEST, output);
|
return Response.withStatusCode(SC_BAD_REQUEST, output);
|
||||||
}
|
}
|
||||||
|
if (input.ready) {
|
||||||
|
output.ready = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Suppress notifications in WorkInProgressOp, we'll take care of
|
// Suppress notifications in WorkInProgressOp, we'll take care of
|
||||||
// them in this endpoint.
|
// them in this endpoint.
|
||||||
WorkInProgressOp.Input wipIn = new WorkInProgressOp.Input();
|
WorkInProgressOp.Input wipIn = new WorkInProgressOp.Input();
|
||||||
|
|||||||
Reference in New Issue
Block a user