diff options
author | 2017-04-19 14:28:05 +0200 | |
---|---|---|
committer | 2017-04-19 14:28:05 +0200 | |
commit | 49039945a1c6964b173e9b96b67b5fe610f48000 (patch) | |
tree | 16bf91a3d4a8fa4cdc72460d28bdeea223dc1316 /juick-www/src | |
parent | 679b8a138cf0302144359f1199a57e920c4e71d8 (diff) |
quick fix for 0 replies issue
Diffstat (limited to 'juick-www/src')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/UserThread.java | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/UserThread.java b/juick-www/src/main/java/com/juick/www/controllers/UserThread.java index 0aeac4c6..c3a2a24e 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/UserThread.java +++ b/juick-www/src/main/java/com/juick/www/controllers/UserThread.java @@ -244,6 +244,32 @@ public class UserThread { } } + boolean foldable = false; + if (replies.size() > 10) { + for (int i = 0; i < replies.size() - 1; i++) { + if (replies.get(i).getChildsCount() > 1) { + foldable = true; + break; + } + } + } + + out.println("<div class=\"title2\">"); + out.print(" <div class=\"title2-right\">"); + if (listview) { + out.print("<a href=\"?view=tree\" rel=\"nofollow\">Показать деревом</a>"); + } else { + if (foldable) { + out.print("<span id=\"unfoldall\"><a href=\"#\">Раскрыть все</a> · </span>"); + } + out.print("<a href=\"?view=list\" rel=\"nofollow\">Показать списком</a>"); + } + out.print("</div>"); + out.println(" <h2>Ответы (" + replies.size() + ")</h2>"); + out.println("</div>"); + + out.println("<ul id=\"replies\">"); + if (!replies.isEmpty()) { if (visitor.getUid() > 0 && msg.getUser().getUid() == visitor.getUid()) { for (Message reply : replies) { @@ -260,43 +286,19 @@ public class UserThread { } } - boolean foldable = false; - if (replies.size() > 10) { - for (int i = 0; i < replies.size() - 1; i++) { - if (replies.get(i).getChildsCount() > 1) { - foldable = true; - break; - } - } - } - - out.println("<div class=\"title2\">"); - out.print(" <div class=\"title2-right\">"); - if (listview) { - out.print("<a href=\"?view=tree\" rel=\"nofollow\">Показать деревом</a>"); - } else { - if (foldable) { - out.print("<span id=\"unfoldall\"><a href=\"#\">Раскрыть все</a> · </span>"); - } - out.print("<a href=\"?view=list\" rel=\"nofollow\">Показать списком</a>"); - } - out.print("</div>"); - out.println(" <h2>Ответы (" + replies.size() + ")</h2>"); - out.println("</div>"); - - out.println("<ul id=\"replies\">"); if (listview) { printList(out, replies, visitor); } else { printTree(out, replies, visitor, 0, 0, false); } - out.println("</ul>"); for (Message reply : replies) { reply.cleanupChilds(); } replies.clear(); } + + out.println("</ul>"); } public void printTree(PrintWriter out, List<com.juick.Message> replies, com.juick.User visitor, int ReplyTo, int margin, boolean hidden) { |