diff options
author | Vitaly Takmazov | 2018-02-20 10:00:58 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-02-20 10:00:58 +0300 |
commit | bf2ed384935a02de6958ebfdd9ebfa316151cf0e (patch) | |
tree | f9c46dfdbcef64d9a5f19fe20cc971f60078ea71 /juick-www/src/main/java/com/juick/www | |
parent | 036a67e5571b39a1f4b65f6f94bfdfcd58097ebc (diff) |
www: sape links in tag
Diffstat (limited to 'juick-www/src/main/java/com/juick/www')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/Messages.java | 8 |
1 files changed, 8 insertions, 0 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 d862e979..74f15d6b 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,6 +394,7 @@ 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(); @@ -451,6 +452,13 @@ 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") |