OutputStreamQuery: fix comments with current-patch-set option
Comments were added at the change level but were not added at the patch set level when using with current-patch-set option. Change-Id: I85336d67ad9aafe972ecfd86f95175093d4449cd
This commit is contained in:
committed by
David Pursehouse
parent
014f1e4e16
commit
61af5c11d8
@@ -196,6 +196,31 @@ public class QueryIT extends AbstractDaemonTest {
|
|||||||
assertThat(changes.get(0).comments.size()).isEqualTo(1);
|
assertThat(changes.get(0).comments.size()).isEqualTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCommentOptionsInCurrentPatchSetJSON() throws Exception {
|
||||||
|
String changeId = createChange().getChangeId();
|
||||||
|
|
||||||
|
ReviewInput review = new ReviewInput();
|
||||||
|
ReviewInput.CommentInput comment = new ReviewInput.CommentInput();
|
||||||
|
comment.path = PushOneCommit.FILE_NAME;
|
||||||
|
comment.side = Side.REVISION;
|
||||||
|
comment.message = "comment 1";
|
||||||
|
review.comments = new HashMap<>();
|
||||||
|
review.comments.put(comment.path, Lists.newArrayList(comment));
|
||||||
|
gApi.changes().id(changeId).current().review(review);
|
||||||
|
|
||||||
|
List<ChangeAttribute> changes =
|
||||||
|
executeSuccessfulQuery("--current-patch-set " + changeId);
|
||||||
|
assertThat(changes.size()).isEqualTo(1);
|
||||||
|
assertThat(changes.get(0).currentPatchSet.comments).isNull();
|
||||||
|
|
||||||
|
changes =
|
||||||
|
executeSuccessfulQuery("--current-patch-set --comments " + changeId);
|
||||||
|
assertThat(changes.size()).isEqualTo(1);
|
||||||
|
assertThat(changes.get(0).currentPatchSet.comments).isNotNull();
|
||||||
|
assertThat(changes.get(0).currentPatchSet.comments.size()).isEqualTo(1);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCommentOptionInPatchSetsJSON() throws Exception {
|
public void testCommentOptionInPatchSetsJSON() throws Exception {
|
||||||
String changeId = createChange().getChangeId();
|
String changeId = createChange().getChangeId();
|
||||||
|
|||||||
@@ -230,6 +230,10 @@ public class OutputStreamQuery {
|
|||||||
eventFactory.addPatchSetFileNames(c.currentPatchSet,
|
eventFactory.addPatchSetFileNames(c.currentPatchSet,
|
||||||
d.change(), d.currentPatchSet());
|
d.change(), d.currentPatchSet());
|
||||||
}
|
}
|
||||||
|
if (includeComments) {
|
||||||
|
eventFactory.addPatchSetComments(c.currentPatchSet,
|
||||||
|
d.publishedComments());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user