Summarize the number of inline comments when publishing a review

We always include a short message indicating the number of draft
comments that were published, this triggers Gerrit to always display
a top-level change message even though no scores were modified and
no cover letter was written by the reviewer.

Bug: issue 396
Change-Id: I1f7a1854b1a12d0ff5e5d27a5e077247b0fb4c71
This commit is contained in:
Martin Fick
2010-06-15 11:54:30 -07:00
committed by Shawn O. Pearce
parent 556b6d7999
commit 47c95702ee

View File

@@ -220,6 +220,8 @@ public class PublishComments implements Callable<VoidResult> {
db.patchSetApprovals().update(upd);
db.patchSetApprovals().insert(ins);
summarizeInlineComments(msgbuf);
message(msgbuf.toString());
}
@@ -298,4 +300,17 @@ public class PublishComments implements Callable<VoidResult> {
hooks.doCommentAddedHook(change, user.getAccount(), patchSet, messageText, changed);
}
private void summarizeInlineComments(StringBuilder in) {
if (!drafts.isEmpty()) {
if (in.length() != 0) {
in.append("\n\n");
}
if (drafts.size() == 1) {
in.append("(1 inline comment)");
} else {
in.append("(" + drafts.size() + " inline comments)");
}
}
}
}