Simplify reporting on the number of comments

This reverts commit aae26d0e14.
The new message formatting is completely unnecessary complexity.
We can just say the number of comments.

Change-Id: I91ebc071ef6da882d5641cd9061299e9b275dfad
This commit is contained in:
Shawn O. Pearce
2012-11-29 10:05:22 -08:00
parent f6ce5cc010
commit 3ed1fc0e77

View File

@@ -455,38 +455,11 @@ public class PostReview implements RestModifyView<RevisionResource, Input> {
for (String d : labelDelta) {
buf.append(" ").append(d);
}
if (comments.size() >= 1) {
int inlineCommentCount = 0;
int fileCommentsCount = 0;
for (PatchLineComment c : comments) {
if (c.getLine() == 0) {
fileCommentsCount++;
} else {
inlineCommentCount++;
}
}
buf.append("\n\n(");
if (fileCommentsCount != 0) {
if (fileCommentsCount == 1) {
buf.append("1 file comment");
} else {
buf.append(String.format("%d file comments", fileCommentsCount));
}
}
if (inlineCommentCount != 0) {
if (fileCommentsCount != 0) {
buf.append(", ");
}
if (inlineCommentCount == 1) {
buf.append("1 inline comment");
} else {
buf.append(String.format("%d inline comments", inlineCommentCount));
}
}
buf.append(")");
if (comments.size() == 1) {
buf.append("\n\n(1 comment)");
} else if (comments.size() > 1) {
buf.append(String.format("\n\n(%d comments)", comments.size()));
}
if (!msg.isEmpty()) {
buf.append("\n\n").append(msg);
}