mirror of https://github.com/halo-dev/halo
Apply filter ip address service
parent
c054644035
commit
738d3e6cd8
|
@ -48,7 +48,8 @@ public class JournalController {
|
|||
public Page<CommentWithHasChildrenVO> listTopComments(@PathVariable("journalId") Integer journalId,
|
||||
@RequestParam(name = "page", required = false, defaultValue = "0") int page,
|
||||
@SortDefault(sort = "createTime", direction = DESC) Sort sort) {
|
||||
return journalCommentService.pageTopCommentsBy(journalId, CommentStatus.PUBLISHED, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
Page<CommentWithHasChildrenVO> result = journalCommentService.pageTopCommentsBy(journalId, CommentStatus.PUBLISHED, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
return journalCommentService.filterIpAddress(result);
|
||||
}
|
||||
|
||||
@GetMapping("{journalId:\\d+}/comments/{commentParentId:\\d+}/children")
|
||||
|
@ -58,7 +59,8 @@ public class JournalController {
|
|||
// Find all children comments
|
||||
List<JournalComment> postComments = journalCommentService.listChildrenBy(journalId, commentParentId, CommentStatus.PUBLISHED, sort);
|
||||
// Convert to base comment dto
|
||||
return journalCommentService.convertTo(postComments);
|
||||
List<BaseCommentDTO> result = journalCommentService.convertTo(postComments);
|
||||
return journalCommentService.filterIpAddress(result);
|
||||
}
|
||||
|
||||
@GetMapping("{journalId:\\d+}/comments/tree_view")
|
||||
|
@ -66,7 +68,8 @@ public class JournalController {
|
|||
public Page<BaseCommentVO> listCommentsTree(@PathVariable("journalId") Integer journalId,
|
||||
@RequestParam(name = "page", required = false, defaultValue = "0") int page,
|
||||
@SortDefault(sort = "createTime", direction = DESC) Sort sort) {
|
||||
return journalCommentService.pageVosBy(journalId, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
Page<BaseCommentVO> result = journalCommentService.pageVosBy(journalId, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
return journalCommentService.filterIpAddress(result);
|
||||
}
|
||||
|
||||
@GetMapping("{journalId:\\d+}/comments/list_view")
|
||||
|
@ -74,7 +77,8 @@ public class JournalController {
|
|||
public Page<BaseCommentWithParentVO> listComments(@PathVariable("journalId") Integer journalId,
|
||||
@RequestParam(name = "page", required = false, defaultValue = "0") int page,
|
||||
@SortDefault(sort = "createTime", direction = DESC) Sort sort) {
|
||||
return journalCommentService.pageWithParentVoBy(journalId, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
Page<BaseCommentWithParentVO> result = journalCommentService.pageWithParentVoBy(journalId, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
return journalCommentService.filterIpAddress(result);
|
||||
}
|
||||
|
||||
@PostMapping("comments")
|
||||
|
|
|
@ -83,7 +83,10 @@ public class PostController {
|
|||
public Page<CommentWithHasChildrenVO> listTopComments(@PathVariable("postId") Integer postId,
|
||||
@RequestParam(name = "page", required = false, defaultValue = "0") int page,
|
||||
@SortDefault(sort = "createTime", direction = DESC) Sort sort) {
|
||||
return postCommentService.pageTopCommentsBy(postId, CommentStatus.PUBLISHED, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
|
||||
Page<CommentWithHasChildrenVO> result = postCommentService.pageTopCommentsBy(postId, CommentStatus.PUBLISHED, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
|
||||
return postCommentService.filterIpAddress(result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,7 +97,10 @@ public class PostController {
|
|||
// Find all children comments
|
||||
List<PostComment> postComments = postCommentService.listChildrenBy(postId, commentParentId, CommentStatus.PUBLISHED, sort);
|
||||
// Convert to base comment dto
|
||||
return postCommentService.convertTo(postComments);
|
||||
|
||||
List<BaseCommentDTO> result = postCommentService.convertTo(postComments);
|
||||
|
||||
return postCommentService.filterIpAddress(result);
|
||||
}
|
||||
|
||||
@GetMapping("{postId:\\d+}/comments/tree_view")
|
||||
|
@ -102,7 +108,8 @@ public class PostController {
|
|||
public Page<BaseCommentVO> listCommentsTree(@PathVariable("postId") Integer postId,
|
||||
@RequestParam(name = "page", required = false, defaultValue = "0") int page,
|
||||
@SortDefault(sort = "createTime", direction = DESC) Sort sort) {
|
||||
return postCommentService.pageVosBy(postId, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
Page<BaseCommentVO> result = postCommentService.pageVosBy(postId, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
return postCommentService.filterIpAddress(result);
|
||||
}
|
||||
|
||||
@GetMapping("{postId:\\d+}/comments/list_view")
|
||||
|
@ -110,7 +117,8 @@ public class PostController {
|
|||
public Page<BaseCommentWithParentVO> listComments(@PathVariable("postId") Integer postId,
|
||||
@RequestParam(name = "page", required = false, defaultValue = "0") int page,
|
||||
@SortDefault(sort = "createTime", direction = DESC) Sort sort) {
|
||||
return postCommentService.pageWithParentVoBy(postId, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
Page<BaseCommentWithParentVO> result = postCommentService.pageWithParentVoBy(postId, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
return postCommentService.filterIpAddress(result);
|
||||
}
|
||||
|
||||
@PostMapping("comments")
|
||||
|
|
|
@ -48,7 +48,8 @@ public class SheetController {
|
|||
public Page<CommentWithHasChildrenVO> listTopComments(@PathVariable("sheetId") Integer sheetId,
|
||||
@RequestParam(name = "page", required = false, defaultValue = "0") int page,
|
||||
@SortDefault(sort = "createTime", direction = DESC) Sort sort) {
|
||||
return sheetCommentService.pageTopCommentsBy(sheetId, CommentStatus.PUBLISHED, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
Page<CommentWithHasChildrenVO> result = sheetCommentService.pageTopCommentsBy(sheetId, CommentStatus.PUBLISHED, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
return sheetCommentService.filterIpAddress(result);
|
||||
}
|
||||
|
||||
@GetMapping("{sheetId:\\d+}/comments/{commentParentId:\\d+}/children")
|
||||
|
@ -58,7 +59,8 @@ public class SheetController {
|
|||
// Find all children comments
|
||||
List<SheetComment> sheetComments = sheetCommentService.listChildrenBy(sheetId, commentParentId, CommentStatus.PUBLISHED, sort);
|
||||
// Convert to base comment dto
|
||||
return sheetCommentService.convertTo(sheetComments);
|
||||
List<BaseCommentDTO> result = sheetCommentService.convertTo(sheetComments);
|
||||
return sheetCommentService.filterIpAddress(result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,7 +69,8 @@ public class SheetController {
|
|||
public Page<BaseCommentVO> listCommentsTree(@PathVariable("sheetId") Integer sheetId,
|
||||
@RequestParam(name = "page", required = false, defaultValue = "0") int page,
|
||||
@SortDefault(sort = "createTime", direction = DESC) Sort sort) {
|
||||
return sheetCommentService.pageVosBy(sheetId, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
Page<BaseCommentVO> result = sheetCommentService.pageVosBy(sheetId, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
return sheetCommentService.filterIpAddress(result);
|
||||
}
|
||||
|
||||
@GetMapping("{sheetId:\\d+}/comments/list_view")
|
||||
|
@ -75,7 +78,8 @@ public class SheetController {
|
|||
public Page<BaseCommentWithParentVO> listComments(@PathVariable("sheetId") Integer sheetId,
|
||||
@RequestParam(name = "page", required = false, defaultValue = "0") int page,
|
||||
@SortDefault(sort = "createTime", direction = DESC) Sort sort) {
|
||||
return sheetCommentService.pageWithParentVoBy(sheetId, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
Page<BaseCommentWithParentVO> result = sheetCommentService.pageWithParentVoBy(sheetId, PageRequest.of(page, optionService.getCommentPageSize(), sort));
|
||||
return sheetCommentService.filterIpAddress(result);
|
||||
}
|
||||
|
||||
@PostMapping("comments")
|
||||
|
|
Loading…
Reference in New Issue