diff options
Diffstat (limited to 'juick-www/src/main/java')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/Messages.java | 21 | ||||
-rw-r--r-- | juick-www/src/main/java/com/mitchellbosecke/pebble/extension/filters/FormatMessageFilter.java | 6 |
2 files changed, 6 insertions, 21 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 c83bb356..11dafda3 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 @@ -506,8 +506,8 @@ public class Messages { protected String threadAction(ModelMap model, @PathVariable String uname, @PathVariable int mid, - @CookieValue(name = "sape_cookie", required = false, defaultValue = StringUtils.EMPTY) String sapeCookie, - @RequestParam(required = false, value = "view") String paramView) { + @CookieValue(name = "sape_cookie", + required = false, defaultValue = StringUtils.EMPTY) String sapeCookie) { com.juick.User visitor = UserUtils.getCurrentUser(); if (!messagesService.canViewThread(mid, visitor.getUid())) { @@ -533,29 +533,12 @@ public class Messages { } model.addAttribute("msg", msg); - boolean listview = false; - if (paramView != null) { - if (paramView.equals("list")) { - listview = true; - if (visitor.getUid() > 0) { - userService.setUserOptionInt(visitor.getUid(), "repliesview", 1); - } - } else if (paramView.equals("tree") && visitor.getUid() > 0) { - userService.setUserOptionInt(visitor.getUid(), "repliesview", 0); - } - } else if (visitor.getUid() > 0 && userService.getUserOptionInt(visitor.getUid(), "repliesview", 0) == 1) { - listview = true; - } - model.addAttribute("listview", listview); String title = msg.getUser().getName() + ": " + msg.getTagsString(); model.addAttribute("title", title); model.addAttribute("visitor", visitor); String headers = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"@" + msg.getUser().getName() + "\" href=\"//rss.juick.com/" + msg.getUser().getName() + "/blog\"/>"; String pageUrl = "https://juick.com/" + msg.getUser().getName() + "/" + msg.getMid(); - if (paramView != null) { - headers += "<link rel=\"canonical\" href=\"" + pageUrl + "\"/>"; - } if (msg.Hidden) { headers += "<meta name=\"robots\" content=\"noindex\"/>"; } 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"); |