diff options
author | 2019-04-26 17:29:25 +0300 | |
---|---|---|
committer | 2019-04-26 17:29:25 +0300 | |
commit | 1b5d8ba596869e7321dd7a0f4757d08306a4d9fd (patch) | |
tree | 5c2ec24ecd1f15fa01618d2938d55e3df6b01f76 /src/main/java/com/juick/server/api/Messages.java | |
parent | a34350b62784d4332243ba40ffe928afd91f67d3 (diff) |
Minimize SQL queries for banned users
Diffstat (limited to 'src/main/java/com/juick/server/api/Messages.java')
-rw-r--r-- | src/main/java/com/juick/server/api/Messages.java | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/main/java/com/juick/server/api/Messages.java b/src/main/java/com/juick/server/api/Messages.java index 60e05d6d..402d2162 100644 --- a/src/main/java/com/juick/server/api/Messages.java +++ b/src/main/java/com/juick/server/api/Messages.java @@ -106,7 +106,7 @@ public class Messages { List<Integer> mids; if (!StringUtils.isEmpty(uname)) { User user = userService.getUserByName(uname); - if (!user.isAnonymous()) { + if (!user.isAnonymous() && !user.isBanned()) { if (!StringUtils.isEmpty(media)) { mids = messagesService.getUserPhotos(user.getUid(), 0, before); } else if (!StringUtils.isEmpty(tag)) { @@ -180,9 +180,6 @@ public class Messages { if (!messagesService.canViewThread(mid, visitor.getUid())) { return FORBIDDEN; } else { - if (userService.getUserByName(msg.getUser().getName()).isBanned()) { - throw new HttpNotFoundException(); - } msg.getUser().setAvatar(webApp.getAvatarUrl(msg.getUser())); msg.setRecommendations(new HashSet<>(messagesService.getMessagesRecommendations( Collections.singletonList(msg.getMid())) |