diff options
author | Vitaly Takmazov | 2018-02-20 10:50:34 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-02-20 10:50:34 +0300 |
commit | 513a7dec3eb5b1edd25f1414097126a22071e33b (patch) | |
tree | 8ede90f3c28044e7ce1130069dc50475a038689a /juick-www/src/main | |
parent | bf2ed384935a02de6958ebfdd9ebfa316151cf0e (diff) |
www: sape links in thread
Diffstat (limited to 'juick-www/src/main')
-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 74f15d6b..3775a702 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"; } |