aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server/api/rss
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/server/api/rss')
-rw-r--r--src/main/java/com/juick/server/api/rss/Feeds.java12
1 files changed, 7 insertions, 5 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 d6e0587c..5a5d42eb 100644
--- a/src/main/java/com/juick/server/api/rss/Feeds.java
+++ b/src/main/java/com/juick/server/api/rss/Feeds.java
@@ -19,9 +19,9 @@ package com.juick.server.api.rss;
import com.juick.User;
import com.juick.server.util.HttpNotFoundException;
-import com.juick.server.util.UserUtils;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
+import com.juick.service.security.annotation.Visitor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -43,25 +43,27 @@ public class Feeds {
private UserService userService;
@GetMapping("/rss/{userName}/blog")
- public ModelAndView getBlog(@PathVariable String userName) {
+ public ModelAndView getBlog(@Visitor User visitor, @PathVariable String userName) {
User user = userService.getUserByName(userName);
if (!user.isAnonymous() && !user.isBanned()) {
List<Integer> mids = messagesService.getUserBlog(user.getUid(), 0, 0);
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("messagesView");
modelAndView.addObject("user", user);
- modelAndView.addObject("messages", messagesService.getMessages(UserUtils.getCurrentUser(), mids));
+ modelAndView.addObject("messages", messagesService.getMessages(visitor, mids));
return modelAndView;
}
throw new HttpNotFoundException();
}
@GetMapping("/rss/")
- public ModelAndView getLast(@RequestParam(value = "hours", required = false, defaultValue = "0") Integer hours) {
+ public ModelAndView getLast(
+ @Visitor User visitor,
+ @RequestParam(value = "hours", required = false, defaultValue = "0") Integer hours) {
List<Integer> mids = messagesService.getLastMessages(hours);
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("messagesView");
- modelAndView.addObject("messages", messagesService.getMessages(UserUtils.getCurrentUser(),mids));
+ modelAndView.addObject("messages", messagesService.getMessages(visitor, mids));
return modelAndView;
}
@GetMapping("/rss/comments")