diff options
author | 2018-12-06 09:37:41 +0300 | |
---|---|---|
committer | 2018-12-06 09:37:41 +0300 | |
commit | 7b35e27edb4960172d32b7a6069748c3f84956b9 (patch) | |
tree | 848ebe1ae69b343f3c587d18d9ce991aad7aec1b /src/main/java/com/juick/server/www/controllers/MessagesWWW.java | |
parent | 2c13aa3dabd28d6b529d0008980e863415432321 (diff) |
cleanup
Diffstat (limited to 'src/main/java/com/juick/server/www/controllers/MessagesWWW.java')
-rw-r--r-- | src/main/java/com/juick/server/www/controllers/MessagesWWW.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/com/juick/server/www/controllers/MessagesWWW.java b/src/main/java/com/juick/server/www/controllers/MessagesWWW.java index ad988bcb..1c69db32 100644 --- a/src/main/java/com/juick/server/www/controllers/MessagesWWW.java +++ b/src/main/java/com/juick/server/www/controllers/MessagesWWW.java @@ -601,6 +601,30 @@ public class MessagesWWW { return "views/thread"; } + @GetMapping("/post") + protected String postAction(@RequestParam(required = false) String body, ModelMap model) { + com.juick.User visitor = UserUtils.getCurrentUser(); + fillUserModel(model, visitor, visitor); + visitor.setAvatar(webApp.getAvatarWebPath(visitor)); + model.addAttribute("title", "Написать"); + model.addAttribute("headers", ""); + model.addAttribute("visitor", visitor); + if (body == null) { + body = StringUtils.EMPTY; + } else { + if (body.length() > 4096) { + body = body.substring(0, 4096); + } + body = StringEscapeUtils.escapeHtml4(body); + } + model.addAttribute("body", body); + model.addAttribute("visitor", visitor); + model.addAttribute("user", visitor); + model.addAttribute("tags", tagService.getUserTagStats(visitor.getUid()).stream() + .sorted((e1, e2) -> Integer.compare(e2.getUsageCount(), e1.getUsageCount())).map(t -> t.getTag().getName()).collect(Collectors.toList())); + return "views/post"; + } + // when message id is not fit to int @ExceptionHandler(NumberFormatException.class) public ResponseEntity<String> notFoundAction() { |