aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/server/api')
-rw-r--r--src/main/java/com/juick/server/api/Messages.java5
-rw-r--r--src/main/java/com/juick/server/api/activity/Profile.java2
-rw-r--r--src/main/java/com/juick/server/api/rss/Feeds.java5
3 files changed, 5 insertions, 7 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()))
diff --git a/src/main/java/com/juick/server/api/activity/Profile.java b/src/main/java/com/juick/server/api/activity/Profile.java
index 4e375a54..701b1949 100644
--- a/src/main/java/com/juick/server/api/activity/Profile.java
+++ b/src/main/java/com/juick/server/api/activity/Profile.java
@@ -136,7 +136,7 @@ public class Profile {
@RequestParam(required = false, defaultValue = "0") int before) {
User visitor = UserUtils.getCurrentUser();
User user = userService.getUserByName(userName);
- if (!user.isAnonymous()) {
+ if (!user.isAnonymous() && !user.isBanned()) {
UriComponentsBuilder uri = UriComponentsBuilder.fromUriString(baseUri);
String personUri = uri.path(String.format("/u/%s", userName)).toUriString();
List<Integer> mids = messagesService.getUserBlog(user.getUid(), 0, before);
diff --git a/src/main/java/com/juick/server/api/rss/Feeds.java b/src/main/java/com/juick/server/api/rss/Feeds.java
index c72f3a5e..47d9fd5e 100644
--- a/src/main/java/com/juick/server/api/rss/Feeds.java
+++ b/src/main/java/com/juick/server/api/rss/Feeds.java
@@ -19,6 +19,7 @@ package com.juick.server.api.rss;
import com.juick.User;
import com.juick.server.util.HttpBadRequestException;
+import com.juick.server.util.HttpNotFoundException;
import com.juick.server.util.UserUtils;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
@@ -46,7 +47,7 @@ public class Feeds {
@RequestMapping(value = "/rss/{userName}/blog", method = RequestMethod.GET, produces = "text/xml; charset=utf-8")
public ModelAndView getBlog(@PathVariable String userName) {
User user = userService.getUserByName(userName);
- if (!user.isAnonymous()) {
+ if (!user.isAnonymous() && !user.isBanned()) {
List<Integer> mids = messagesService.getUserBlog(user.getUid(), 0, 0);
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("messagesView");
@@ -54,7 +55,7 @@ public class Feeds {
modelAndView.addObject("messages", messagesService.getMessages(UserUtils.getCurrentUser(), mids));
return modelAndView;
}
- throw new HttpBadRequestException();
+ throw new HttpNotFoundException();
}
@RequestMapping(value = "/rss/", method = RequestMethod.GET, produces = "text/xml; charset=utf-8")