From c3a9365645ec94d5b7c9778ab32c93e5eb4be5f6 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 29 Apr 2019 14:06:24 +0300 Subject: UserUtils -> @Visitor --- src/main/java/com/juick/server/api/rss/Feeds.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/juick/server/api/rss') 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 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 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") -- cgit v1.2.3