Remove changeId from RevisionNoteData.CommentKey
Inline comments are stored in refs that contain the change ID, hence it's redundant to store the change ID again for each comment. Remove the changeId from CommentKey, so that it cannot be inconsistent with the changeId from the ref. Change-Id: Ibcbb59cf9ad4f1e6fbe94e1ac134daf6d50a4c05 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -83,7 +83,7 @@ class RevisionNote {
|
|||||||
|
|
||||||
if (isJson(raw, p.value)) {
|
if (isJson(raw, p.value)) {
|
||||||
RevisionNoteData data = parseJson(noteUtil, p.value);
|
RevisionNoteData data = parseJson(noteUtil, p.value);
|
||||||
comments = data.exportComments(status);
|
comments = data.exportComments(changeId, status);
|
||||||
if (status == PatchLineComment.Status.PUBLISHED) {
|
if (status == PatchLineComment.Status.PUBLISHED) {
|
||||||
pushCert = data.pushCert;
|
pushCert = data.pushCert;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -48,19 +48,17 @@ class RevisionNoteData {
|
|||||||
String uuid;
|
String uuid;
|
||||||
String filename;
|
String filename;
|
||||||
int patchSetId;
|
int patchSetId;
|
||||||
int changeId;
|
|
||||||
|
|
||||||
CommentKey(PatchLineComment.Key k) {
|
CommentKey(PatchLineComment.Key k) {
|
||||||
uuid = k.get();
|
uuid = k.get();
|
||||||
filename = k.getParentKey().getFileName();
|
filename = k.getParentKey().getFileName();
|
||||||
patchSetId = k.getParentKey().getParentKey().get();
|
patchSetId = k.getParentKey().getParentKey().get();
|
||||||
changeId = k.getParentKey().getParentKey().getParentKey().get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PatchLineComment.Key export() {
|
PatchLineComment.Key export(Change.Id changeId) {
|
||||||
return new PatchLineComment.Key(
|
return new PatchLineComment.Key(
|
||||||
new Patch.Key(
|
new Patch.Key(
|
||||||
new PatchSet.Id(new Change.Id(changeId), patchSetId),
|
new PatchSet.Id(changeId, patchSetId),
|
||||||
filename),
|
filename),
|
||||||
uuid);
|
uuid);
|
||||||
}
|
}
|
||||||
@@ -112,9 +110,10 @@ class RevisionNoteData {
|
|||||||
this.serverId = serverId;
|
this.serverId = serverId;
|
||||||
}
|
}
|
||||||
|
|
||||||
PatchLineComment export(PatchLineComment.Status status) {
|
PatchLineComment export(Change.Id changeId,
|
||||||
|
PatchLineComment.Status status) {
|
||||||
PatchLineComment plc = new PatchLineComment(
|
PatchLineComment plc = new PatchLineComment(
|
||||||
key.export(), lineNbr, author.export(), parentUuid, writtenOn);
|
key.export(changeId), lineNbr, author.export(), parentUuid, writtenOn);
|
||||||
plc.setSide(side);
|
plc.setSide(side);
|
||||||
plc.setMessage(message);
|
plc.setMessage(message);
|
||||||
if (range != null) {
|
if (range != null) {
|
||||||
@@ -131,11 +130,12 @@ class RevisionNoteData {
|
|||||||
String pushCert;
|
String pushCert;
|
||||||
List<Comment> comments;
|
List<Comment> comments;
|
||||||
|
|
||||||
ImmutableList<PatchLineComment> exportComments(
|
|
||||||
|
ImmutableList<PatchLineComment> exportComments(Change.Id changeId,
|
||||||
PatchLineComment.Status status) {
|
PatchLineComment.Status status) {
|
||||||
return ImmutableList.copyOf(
|
return ImmutableList.copyOf(
|
||||||
comments.stream()
|
comments.stream()
|
||||||
.map(c -> c.export(status))
|
.map(c -> c.export(changeId, status))
|
||||||
.collect(toList()));
|
.collect(toList()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user