From 3ed1fc0e772ced8c79c57327b6b9181b90ab6ec9 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 29 Nov 2012 10:05:22 -0800 Subject: [PATCH] Simplify reporting on the number of comments This reverts commit aae26d0e14fdd8e24e9a2f33422b24abd134e335. The new message formatting is completely unnecessary complexity. We can just say the number of comments. Change-Id: I91ebc071ef6da882d5641cd9061299e9b275dfad --- .../gerrit/server/change/PostReview.java | 35 +++---------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java index a24ae3ec01..d165a4a0f9 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java @@ -455,38 +455,11 @@ public class PostReview implements RestModifyView { 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); }