🐛 评论者不是作者本人才消息通知文章作者

This commit is contained in:
x ronger 2020-03-08 00:53:36 +08:00
parent 0e053ef714
commit ef56fba867

View File

@ -81,18 +81,20 @@ public class CommentServiceImpl extends AbstractService<Comment> implements Comm
commentSharpUrl.append("/comment/").append(comment.getIdComment()); commentSharpUrl.append("/comment/").append(comment.getIdComment());
commentMapper.updateCommentSharpUrl(comment.getIdComment(), commentSharpUrl.toString()); commentMapper.updateCommentSharpUrl(comment.getIdComment(), commentSharpUrl.toString());
String commentContent = comment.getCommentContent(); // 评论者不是作者本人则进行消息通知
if(StringUtils.isNotBlank(commentContent)){ if (!article.getArticleAuthorId().equals(comment.getCommentAuthorId())) {
Integer length = commentContent.length(); String commentContent = comment.getCommentContent();
if(length > MAX_PREVIEW){ if(StringUtils.isNotBlank(commentContent)){
length = 200; Integer length = commentContent.length();
if(length > MAX_PREVIEW){
length = 200;
}
String commentPreviewContent = commentContent.substring(0,length);
commentContent = Html2TextUtil.getContent(commentPreviewContent);
NotificationUtils.saveNotification(article.getArticleAuthorId(),comment.getIdComment(), NotificationConstant.Comment, commentContent);
} }
String commentPreviewContent = commentContent.substring(0,length);
commentContent = Html2TextUtil.getContent(commentPreviewContent);
} }
NotificationUtils.saveNotification(article.getArticleAuthorId(),comment.getIdComment(), NotificationConstant.Comment, commentContent);
return map; return map;
} }
} }