aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/www/controllers
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-03-13 15:18:03 +0300
committerGravatar Vitaly Takmazov2018-03-13 15:18:03 +0300
commitf010d75872763547ecbe621ae3e8eb967950453f (patch)
tree385d3f0a960e10c7fd054fcb71ea280142495d31 /juick-www/src/main/java/com/juick/www/controllers
parentcd7e11563721d223b30f9b9edaa8295c2c97c6f7 (diff)
core: cleanup unused message properties
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/controllers')
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/Messages.java32
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/NewMessage.java3
2 files changed, 6 insertions, 29 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/Messages.java b/juick-www/src/main/java/com/juick/www/controllers/Messages.java
index 11dafda3..ea66e711 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/Messages.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/Messages.java
@@ -16,6 +16,7 @@
*/
package com.juick.www.controllers;
+import com.juick.Message;
import com.juick.Tag;
import com.juick.formatters.PlainTextFormatter;
import com.juick.server.util.HttpForbiddenException;
@@ -23,6 +24,7 @@ import com.juick.server.util.HttpNotFoundException;
import com.juick.server.util.UserUtils;
import com.juick.server.util.WebUtils;
import com.juick.service.*;
+import com.juick.util.MessageUtils;
import com.juick.www.Utils;
import org.apache.commons.codec.CharEncoding;
import org.apache.commons.lang3.StringUtils;
@@ -533,7 +535,7 @@ public class Messages {
}
model.addAttribute("msg", msg);
- String title = msg.getUser().getName() + ": " + msg.getTagsString();
+ String title = msg.getUser().getName() + ": " + MessageUtils.getTagsString(msg);
model.addAttribute("title", title);
model.addAttribute("visitor", visitor);
@@ -576,26 +578,11 @@ public class Messages {
List<com.juick.Message> replies = messagesService.getReplies(msg.getMid());
List<Integer> blUIDs = new ArrayList<>();
- for (int i = 0; i < replies.size(); i++) {
- com.juick.Message reply = replies.get(i);
+ for (Message reply : replies) {
if (reply.getUser().getUid() != msg.getUser().getUid()
&& !blUIDs.contains(reply.getUser().getUid())) {
blUIDs.add(reply.getUser().getUid());
}
- if (reply.getReplyto() > 0) {
- boolean added = false;
- for (int n = 0; n < replies.size(); n++) {
- if (replies.get(n).getRid() == reply.getReplyto()) {
- replies.get(n).childs.add(reply);
- added = true;
- break;
- }
- }
- if (!added) {
- reply.setReplyto(0);
- }
- }
-
reply.VisitorCanComment = visitor.getUid() > 0;
if (visitor.getUid() > 0) {
boolean isMsgAuthor = visitor.getUid() == msg.getUser().getUid();
@@ -604,18 +591,7 @@ public class Messages {
&& msg.VisitorCanComment && (isReplyAuthor || !userService.isInBLAny(visitor.getUid(), reply.getUser().getUid())));
}
}
-
- 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;
- }
- }
- }
model.addAttribute("replies", replies);
- model.addAttribute("foldable", foldable);
model.addAttribute("showAdv", visitor.getUid() == 0);
UriComponents builder = ServletUriComponentsBuilder.fromCurrentRequestUri().build();
String queryString = builder.getQuery();
diff --git a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java
index 4d3b4351..6d7de920 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java
@@ -22,6 +22,7 @@ import com.juick.User;
import com.juick.server.helpers.AnonymousUser;
import com.juick.server.util.*;
import com.juick.service.*;
+import com.juick.util.MessageUtils;
import com.juick.www.WebApp;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.StringEscapeUtils;
@@ -148,7 +149,7 @@ public class NewMessage {
}
if (webApp.getXmpp() != null) {
- xmsg.setBody("@" + jmsg.getUser().getName() + ":" + jmsg.getTagsString() + "\n" + body + "\n\n#" + mid + " http://juick.com/" + mid);
+ xmsg.setBody("@" + jmsg.getUser().getName() + ":" + MessageUtils.getTagsString(jmsg) + "\n" + body + "\n\n#" + mid + " http://juick.com/" + mid);
xmsg.setTo(Jid.of("juick@s2s.juick.com"));
webApp.getXmpp().send(xmsg);