aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/mitchellbosecke
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-03-07 14:53:23 +0300
committerGravatar Vitaly Takmazov2018-03-13 08:12:18 +0300
commit1f5869fcfe8c537d223b750754025cb2937d4bad (patch)
treeadb9e8f12e41eb4f2659ea4079c05729d42f33c1 /juick-www/src/main/java/com/mitchellbosecke
parentc25f908aa587a60912f7350806e54de2b7f3dc04 (diff)
drop replies tree
Diffstat (limited to 'juick-www/src/main/java/com/mitchellbosecke')
-rw-r--r--juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java6
1 files changed, 4 insertions, 2 deletions
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 b492f121..14af2539 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,8 +35,10 @@ 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 formattedMessage = isCode ? MessageUtils.formatMessageCode(StringUtils.defaultString(msg.getText()))
- : MessageUtils.formatMessage(StringUtils.defaultString(msg.getText()));
+ String msgTxt = msg.getRid() > 0 ? String.format("@%s, %s", msg.getTo().getName(), StringUtils.defaultString(msg.getText()))
+ : StringUtils.defaultString(msg.getText());
+ String formattedMessage = isCode ? MessageUtils.formatMessageCode(msgTxt)
+ : MessageUtils.formatMessage(msgTxt);
return new SafeString(formattedMessage);
}
throw new IllegalArgumentException("invalid input");