From 1b5d8ba596869e7321dd7a0f4757d08306a4d9fd Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 26 Apr 2019 17:29:25 +0300 Subject: Minimize SQL queries for banned users --- src/main/java/com/juick/server/www/controllers/MessagesWWW.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/juick/server/www') diff --git a/src/main/java/com/juick/server/www/controllers/MessagesWWW.java b/src/main/java/com/juick/server/www/controllers/MessagesWWW.java index 41c95dcb..e1c1bed8 100644 --- a/src/main/java/com/juick/server/www/controllers/MessagesWWW.java +++ b/src/main/java/com/juick/server/www/controllers/MessagesWWW.java @@ -224,7 +224,7 @@ public class MessagesWWW { if (paramTag == null) { throw new HttpNotFoundException(); } else if (!paramTag.getName().equals(paramTagStr)) { - String url = user.getName() + "/?tag=" + URLEncoder.encode(paramTag.getName(), CharEncoding.UTF_8); + String url = user.getName() + "/?tag=" + URLEncoder.encode(paramTag.getName(), StandardCharsets.UTF_8); return "redirect:/" + url; } } @@ -510,7 +510,7 @@ public class MessagesWWW { visitor.setAvatar(webApp.getAvatarWebPath(visitor)); Optional message = messagesService.getMessage(mid); - if (!message.isPresent() || message.get().getUser().isBanned()) { + if (message.isEmpty()) { throw new HttpNotFoundException(); } -- cgit v1.2.3