|
|
@@ -42,7 +42,9 @@ public class CommentController {
|
|
|
public CommentVO createComment(LoginUser user,
|
|
|
@Validated @RequestBody CommentDTO commentDTO) {
|
|
|
CommentVO commentVO = commentService.createComment(user, commentDTO);
|
|
|
- CommentWebsocket.sendAllMessageToOneSlide(commentDTO.getSlideId(), JsonUtils.toJson(commentVO));
|
|
|
+ if (commentVO.getShow()) {
|
|
|
+ CommentWebsocket.sendAllMessageToOneSlide(commentDTO.getSlideId(), JsonUtils.toJson(commentVO));
|
|
|
+ }
|
|
|
return commentVO;
|
|
|
}
|
|
|
|
|
|
@@ -101,11 +103,11 @@ public class CommentController {
|
|
|
*/
|
|
|
@Auth(roles = {UserRole.TEACHER, UserRole.STUDENT}, message = "获取自己的评论")
|
|
|
@GetMapping("/slide/{slideId}/self")
|
|
|
- public PageResponse<CommentVO> getSelfComments(LoginUser user,
|
|
|
- @PathVariable Long slideId,
|
|
|
- @RequestParam(required = false, defaultValue = "1") Integer pageNumber,
|
|
|
- @RequestParam(required = false, defaultValue = "true") Boolean show,
|
|
|
- @PageableDefault(Integer.MAX_VALUE) Pageable pageable) {
|
|
|
+ public PageResponse<CommentVO> getSelfCommentsBySlide(LoginUser user,
|
|
|
+ @PathVariable Long slideId,
|
|
|
+ @RequestParam(required = false, defaultValue = "1") Integer pageNumber,
|
|
|
+ @RequestParam(required = false, defaultValue = "true") Boolean show,
|
|
|
+ @PageableDefault(Integer.MAX_VALUE) Pageable pageable) {
|
|
|
return PageResponse.of(commentService.getSelfCommentsBySlideAndPageNumber(user, slideId, pageNumber, show, pageable));
|
|
|
}
|
|
|
|
|
|
@@ -120,6 +122,9 @@ public class CommentController {
|
|
|
commentService.modifyCommentShow(user, commentId, show);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 取得自己的评论
|
|
|
+ */
|
|
|
@Auth(roles = {UserRole.TEACHER, UserRole.STUDENT}, message = "获取自己的评论")
|
|
|
@GetMapping("/self")
|
|
|
public PageResponse<CommentVO> getSelfComments(LoginUser user,
|