aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--juick-core/src/main/java/com/juick/util/MessageUtils.java3
-rw-r--r--juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java3
2 files changed, 5 insertions, 1 deletions
diff --git a/juick-core/src/main/java/com/juick/util/MessageUtils.java b/juick-core/src/main/java/com/juick/util/MessageUtils.java
index f17737db..9c156c51 100644
--- a/juick-core/src/main/java/com/juick/util/MessageUtils.java
+++ b/juick-core/src/main/java/com/juick/util/MessageUtils.java
@@ -214,4 +214,7 @@ public class MessageUtils {
return jmsg.getAttachment().getMedium().getUrl();
}
}
+ public static boolean replyStartsWithQuote(Message msg) {
+ return msg.getRid() > 0 && StringUtils.defaultString(msg.getText()).startsWith(">");
+ }
}
diff --git a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java b/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java
index 14af2539..edb6c827 100644
--- a/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java
+++ b/juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java
@@ -35,7 +35,8 @@ public class FormatMessageFilter implements Filter {
if (input instanceof Message) {
Message msg = (Message) input;
boolean isCode = msg.getTags().stream().anyMatch(t -> t.getName().equals("code"));
- String msgTxt = msg.getRid() > 0 ? String.format("@%s, %s", msg.getTo().getName(), StringUtils.defaultString(msg.getText()))
+ String formatString = MessageUtils.replyStartsWithQuote(msg) ? "@%s,\n%s" : "@%s, %s";
+ String msgTxt = msg.getRid() > 0 ? String.format(formatString, msg.getTo().getName(), StringUtils.defaultString(msg.getText()))
: StringUtils.defaultString(msg.getText());
String formattedMessage = isCode ? MessageUtils.formatMessageCode(msgTxt)
: MessageUtils.formatMessage(msgTxt);