Skip to content

Commit

Permalink
fix: #748 (#749)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby authored Apr 5, 2020
1 parent 3a45b7a commit ba1eb8f
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@ public void handleCommentNewEvent(CommentNewEvent newEvent) {

User user = userService.getCurrentUser().orElseThrow(() -> new ServiceException("未查询到博主信息"));


Map<String, Object> data = new HashMap<>();

StringBuilder subject = new StringBuilder();

Boolean enabledAbsolutePath = optionService.isEnabledAbsolutePath();

if (newEvent.getSource() instanceof PostCommentService) {
// Get postComment id
PostComment postComment = postCommentService.getById(newEvent.getCommentId());
Expand All @@ -93,7 +94,7 @@ public void handleCommentNewEvent(CommentNewEvent newEvent) {

BasePostMinimalDTO post = postService.convertToMinimal(postService.getById(postComment.getPostId()));

data.put("pageFullPath", post.getFullPath());
data.put("pageFullPath", enabledAbsolutePath ? post.getFullPath() : optionService.getBlogBaseUrl() + post.getFullPath());
data.put("pageTitle", post.getTitle());
data.put("author", postComment.getAuthor());
data.put("content", postComment.getContent());
Expand All @@ -109,7 +110,7 @@ public void handleCommentNewEvent(CommentNewEvent newEvent) {

BasePostMinimalDTO sheet = sheetService.convertToMinimal(sheetService.getById(sheetComment.getPostId()));

data.put("pageFullPath", sheet.getFullPath());
data.put("pageFullPath", enabledAbsolutePath ? sheet.getFullPath() : optionService.getBlogBaseUrl() + sheet.getFullPath());
data.put("pageTitle", sheet.getTitle());
data.put("author", sheetComment.getAuthor());
data.put("content", sheetComment.getContent());
Expand Down Expand Up @@ -167,6 +168,8 @@ public void handleCommentReplyEvent(CommentReplyEvent replyEvent) {

StringBuilder subject = new StringBuilder();

Boolean enabledAbsolutePath = optionService.isEnabledAbsolutePath();

log.debug("replyEvent.getSource():" + replyEvent.getSource().toString());

if (replyEvent.getSource() instanceof PostCommentService) {
Expand All @@ -187,7 +190,7 @@ public void handleCommentReplyEvent(CommentReplyEvent replyEvent) {

BasePostMinimalDTO post = postService.convertToMinimal(postService.getById(postComment.getPostId()));

data.put("pageFullPath", post.getFullPath());
data.put("pageFullPath", enabledAbsolutePath ? post.getFullPath() : optionService.getBlogBaseUrl() + post.getFullPath());
data.put("pageTitle", post.getTitle());
data.put("baseAuthor", baseComment.getAuthor());
data.put("baseContent", baseComment.getContent());
Expand Down Expand Up @@ -217,7 +220,7 @@ public void handleCommentReplyEvent(CommentReplyEvent replyEvent) {

BasePostMinimalDTO sheet = sheetService.convertToMinimal(sheetService.getById(sheetComment.getPostId()));

data.put("pageFullPath", sheet.getFullPath());
data.put("pageFullPath", enabledAbsolutePath ? sheet.getFullPath() : optionService.getBlogBaseUrl() + sheet.getFullPath());
data.put("pageTitle", sheet.getTitle());
data.put("baseAuthor", baseComment.getAuthor());
data.put("baseContent", baseComment.getContent());
Expand Down

0 comments on commit ba1eb8f

Please sign in to comment.