diff options
Diffstat (limited to 'juick-server/src/main')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/api/Messages.java | 3 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java | 13 |
2 files changed, 6 insertions, 10 deletions
diff --git a/juick-server/src/main/java/com/juick/server/api/Messages.java b/juick-server/src/main/java/com/juick/server/api/Messages.java index 80c718b7..2b171489 100644 --- a/juick-server/src/main/java/com/juick/server/api/Messages.java +++ b/juick-server/src/main/java/com/juick/server/api/Messages.java @@ -169,8 +169,7 @@ public class Messages { if (!messagesService.canViewThread(mid, visitor.getUid())) { return FORBIDDEN; } else { - JuickUser juickUser = new JuickUser(userService.getUserByName(msg.getUser().getName())); - if (!juickUser.isEnabled()) { + if (userService.getUserByName(msg.getUser().getName()).isBanned()) { throw new HttpNotFoundException(); } msg.setRecommendations(new HashSet<>(messagesService.getMessageRecommendations(msg.getMid()))); diff --git a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java index 125e4f63..913ee747 100644 --- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -651,8 +651,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ .addValue("privacy", privacy) .addValue("before", before); - JuickUser juickUser = new JuickUser(userService.getUserByUID(uid).orElseThrow(IllegalStateException::new)); - if (!juickUser.isEnabled()) { + ; + if (userService.getUserByUID(uid).orElseThrow(IllegalStateException::new).isBanned()) { throw new HttpNotFoundException(); } @@ -674,8 +674,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ .addValue("privacy", privacy) .addValue("before", before); - JuickUser juickUser = new JuickUser(userService.getUserByUID(uid).orElseThrow(IllegalStateException::new)); - if (!juickUser.isEnabled()) { + if (userService.getUserByUID(uid).orElseThrow(IllegalStateException::new).isBanned()) { throw new HttpNotFoundException(); } @@ -697,8 +696,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ .addValue("privacy", privacy) .addValue("daysback", daysback); - JuickUser juickUser = new JuickUser(userService.getUserByUID(uid).orElseThrow(IllegalStateException::new)); - if (!juickUser.isEnabled()) { + if (userService.getUserByUID(uid).orElseThrow(IllegalStateException::new).isBanned()) { throw new HttpNotFoundException(); } @@ -720,8 +718,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ .addValue("privacy", privacy) .addValue("before", before); - JuickUser juickUser = new JuickUser(userService.getUserByUID(uid).orElseThrow(IllegalStateException::new)); - if (!juickUser.isEnabled()) { + if (userService.getUserByUID(uid).orElseThrow(IllegalStateException::new).isBanned()) { throw new HttpNotFoundException(); } |