aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/www')
-rw-r--r--src/main/java/com/juick/www/filters/AnythingFilter.java11
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 a725a66fd..2ec828018 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);
}