aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/mitchellbosecke
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/main/java/com/mitchellbosecke')
-rw-r--r--juick-server/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/juick-server/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java b/juick-server/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java
index f347c1c3..1b75727e 100644
--- a/juick-server/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java
+++ b/juick-server/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java
@@ -42,14 +42,18 @@ public class FormatMessageFilter implements Filter {
return new SafeString(msg.getText());
}
boolean isCode = msg.getTags().stream().anyMatch(t -> t.getName().equals("code"));
- String toUserString = msg.getTo().getUid() == 0 ? String.format("<a href=\"%s\" data-user-uri=\"1\">@%s</a>",
- msg.getTo().getUri().toASCIIString(), msg.getTo().getName()) : String.format("<a href=\"https://juick.com/%s/\">@%s</a>", msg.getTo().getName(), msg.getTo().getName());
- String formatString = MessageUtils.replyStartsWithQuote(msg) ? "%s,\n%s" : "%s, %s";
String formattedMessage = isCode ? MessageUtils.formatMessageCode(StringUtils.defaultString(msg.getText()))
: MessageUtils.formatMessage(StringUtils.defaultString(msg.getText()));
- String msgTxt = msg.getRid() > 0 ? String.format(formatString, toUserString, formattedMessage)
- : formattedMessage;
- return new SafeString(msgTxt);
+ if (MessageUtils.isPM(msg)) {
+ return new SafeString(formattedMessage);
+ } else {
+ String toUserString = msg.getTo().getUid() == 0 ? String.format("<a href=\"%s\" data-user-uri=\"1\">@%s</a>",
+ msg.getTo().getUri().toASCIIString(), msg.getTo().getName()) : String.format("<a href=\"https://juick.com/%s/\">@%s</a>", msg.getTo().getName(), msg.getTo().getName());
+ String formatString = MessageUtils.replyStartsWithQuote(msg) ? "%s,\n%s" : "%s, %s";
+ String msgTxt = msg.getRid() > 0 ? String.format(formatString, toUserString, formattedMessage)
+ : formattedMessage;
+ return new SafeString(msgTxt);
+ }
}
throw new IllegalArgumentException("invalid input");
}