diff options
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/controllers')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/Messages.java | 19 |
1 files changed, 10 insertions, 9 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 74f15d6bb..3775a7024 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 @@ -394,7 +394,6 @@ public class Messages { protected String tagAction(HttpServletRequest request, @PathVariable String tagName, @RequestParam(required = false, defaultValue = "0") int before, - @CookieValue(name = "sape_cookie", required = false, defaultValue = StringUtils.EMPTY) String sapeCookie, ModelMap model) throws IOException { com.juick.User visitor = UserUtils.getCurrentUser(); @@ -452,13 +451,6 @@ public class Messages { String nextpage = "/tag/" + URLEncoder.encode(paramTag.getName(), CharEncoding.UTF_8) + "?before=" + mids.get(mids.size() - 1); model.addAttribute("nextpage", nextpage); } - UriComponents builder = ServletUriComponentsBuilder.fromCurrentRequestUri().build(); - String queryString = builder.getQuery(); - String requestURI = builder.toUri().getPath(); - if (sape != null && visitor.getUid() == 0 && queryString == null) { - String links = sape.getPageLinks(requestURI, sapeCookie).render(); - model.addAttribute("links", links); - } return "views/index"; } @GetMapping("/pm/inbox") @@ -502,7 +494,8 @@ public class Messages { protected String threadAction(ModelMap model, @PathVariable String uname, @PathVariable int mid, - @RequestParam(required = false, value = "view") String paramView) throws IOException { + @CookieValue(name = "sape_cookie", required = false, defaultValue = StringUtils.EMPTY) String sapeCookie, + @RequestParam(required = false, value = "view") String paramView) { com.juick.User visitor = UserUtils.getCurrentUser(); if (!messagesService.canViewThread(mid, visitor.getUid())) { @@ -628,6 +621,14 @@ public class Messages { } model.addAttribute("replies", replies); model.addAttribute("foldable", foldable); + model.addAttribute("showAdv", visitor.getUid() == 0); + UriComponents builder = ServletUriComponentsBuilder.fromCurrentRequestUri().build(); + String queryString = builder.getQuery(); + String requestURI = builder.toUri().getPath(); + if (sape != null && visitor.getUid() == 0 && queryString == null) { + String links = sape.getPageLinks(requestURI, sapeCookie).render(); + model.addAttribute("links", links); + } return "views/thread"; } |