aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www/rss/Feeds.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-01-13 17:38:06 +0300
committerGravatar Vitaly Takmazov2023-01-13 18:11:56 +0300
commit35d25bbc9d261e7b5585d0fd1d398dff3ab4a176 (patch)
tree68a4d0b0190635615438343f6f6c52cacc213179 /src/main/java/com/juick/www/rss/Feeds.java
parent8b70eded6c9cc3b9cf634356239701fe65779791 (diff)
Fix OpenAPI generation
* Use HandlerMethodArgumentResolver to pass visitor * Hide visitor from OpenAPI definitions * Drop unused AsciiDoc template
Diffstat (limited to 'src/main/java/com/juick/www/rss/Feeds.java')
-rw-r--r--src/main/java/com/juick/www/rss/Feeds.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/juick/www/rss/Feeds.java b/src/main/java/com/juick/www/rss/Feeds.java
index 41b006a6..4e64bc5a 100644
--- a/src/main/java/com/juick/www/rss/Feeds.java
+++ b/src/main/java/com/juick/www/rss/Feeds.java
@@ -22,6 +22,7 @@ import com.juick.util.HttpNotFoundException;
import com.juick.service.MessagesService;
import com.juick.service.UserService;
+import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.core.convert.ConversionFailedException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -49,7 +50,7 @@ public class Feeds {
}
@GetMapping("/rss/{userName}/{feedType}")
- public ModelAndView getBlog(@ModelAttribute User visitor, @PathVariable String userName, @PathVariable FeedType feedType) {
+ public ModelAndView getBlog(@Parameter(hidden = true) User visitor, @PathVariable String userName, @PathVariable FeedType feedType) {
User user = userService.getUserByName(userName);
if (!user.isAnonymous() && !user.isBanned()) {
List<Integer> mids = feedType == FeedType.blog ? messagesService.getUserBlog(user.getUid(), 0, 0) : messagesService.getUserBlogWithRecommendations(user, visitor, 0, 0);
@@ -65,11 +66,12 @@ public class Feeds {
@GetMapping("/rss/")
public ModelAndView getLast(
- @ModelAttribute User visitor,
+ @Parameter(hidden = true) 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("user", visitor);
modelAndView.addObject("messages", messagesService.getMessages(visitor, mids));
return modelAndView;
}