Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
IEQEFCR
halo
提交
738d3e6c
H
halo
项目概览
IEQEFCR
/
halo
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
halo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
738d3e6c
编写于
5月 30, 2019
作者:
J
johnniang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Apply filter ip address service
上级
c0546440
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
12 deletion
+28
-12
src/main/java/run/halo/app/controller/content/api/JournalController.java
...un/halo/app/controller/content/api/JournalController.java
+8
-4
src/main/java/run/halo/app/controller/content/api/PostController.java
...a/run/halo/app/controller/content/api/PostController.java
+12
-4
src/main/java/run/halo/app/controller/content/api/SheetController.java
.../run/halo/app/controller/content/api/SheetController.java
+8
-4
未找到文件。
src/main/java/run/halo/app/controller/content/api/JournalController.java
浏览文件 @
738d3e6c
...
...
@@ -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"
)
...
...
src/main/java/run/halo/app/controller/content/api/PostController.java
浏览文件 @
738d3e6c
...
...
@@ -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"
)
...
...
src/main/java/run/halo/app/controller/content/api/SheetController.java
浏览文件 @
738d3e6c
...
...
@@ -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"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录