aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server/api/rss
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-04-29 14:06:24 +0300
committerGravatar Vitaly Takmazov2019-04-29 14:06:24 +0300
commitc3a9365645ec94d5b7c9778ab32c93e5eb4be5f6 (patch)
treed853fc7df61fdc18a20a52c93291853796e9a60f /src/main/java/com/juick/server/api/rss
parent409ef92da23f4b650340197e7383ba8b528999e4 (diff)
UserUtils -> @Visitor
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")