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/rss/Feeds.java | |
parent | a34350b62784d4332243ba40ffe928afd91f67d3 (diff) |
Minimize SQL queries for banned users
Diffstat (limited to 'src/main/java/com/juick/server/api/rss/Feeds.java')
-rw-r--r-- | src/main/java/com/juick/server/api/rss/Feeds.java | 5 |
1 files changed, 3 insertions, 2 deletions
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") |