diff options
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); } |