diff options
author | Vitaly Takmazov | 2022-12-09 14:45:24 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2022-12-09 14:45:52 +0300 |
commit | a5ccfcd3f3e8d96250c92638cf2f66736827ffbc (patch) | |
tree | ddab5a2464976533d27ae9eb92dfcb5b71c9b06b /src/main/java/com/juick/www | |
parent | 13b81d40fde2939500924403dd767bdc9887ff14 (diff) |
Better caching in AnythingFilter
Diffstat (limited to 'src/main/java/com/juick/www')
-rw-r--r-- | src/main/java/com/juick/www/filters/AnythingFilter.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main/java/com/juick/www/filters/AnythingFilter.java b/src/main/java/com/juick/www/filters/AnythingFilter.java index a725a66f..2ec82801 100644 --- a/src/main/java/com/juick/www/filters/AnythingFilter.java +++ b/src/main/java/com/juick/www/filters/AnythingFilter.java @@ -71,16 +71,15 @@ public class AnythingFilter extends OncePerRequestFilter { } } } - User user = userService.getUserByName(anything); - if (user.getUid() > 0) { - servletResponse.sendRedirect("/" + user.getName() + "/"); + ; + if (userService.getUsernames().stream().anyMatch(name -> name.equals(anything))) { + servletResponse.sendRedirect("/" + anything + "/"); } else { filterChain.doFilter(servletRequest, servletResponse); } } else { - User user = userService.getUserByName(anything); - if (!user.isAnonymous()) { - servletResponse.sendRedirect("/" + user.getName() + "/?before=" + before); + if (userService.getUsernames().stream().anyMatch(name -> name.equals(anything))) { + servletResponse.sendRedirect("/" + anything + "/?before=" + before); } else { filterChain.doFilter(servletRequest, servletResponse); } |