use of org.eclipse.vorto.repository.notification.message.CommentReplyMessage in project vorto by eclipse.
the class DefaultCommentService method notifyAllCommentAuthors.
private void notifyAllCommentAuthors(Comment comment, ModelInfo model) {
Set<String> recipients = new HashSet<>();
recipients.add(model.getAuthor());
List<Comment> existingComments = this.commentRepository.findByModelId(comment.getModelId());
for (Comment c : existingComments) {
recipients.add(c.getAuthor());
}
recipients.stream().filter(recipient -> !User.USER_ANONYMOUS.equalsIgnoreCase(recipient)).forEach(recipient -> {
User user = accountService.getUser(recipient);
if (user != null) {
notificationService.sendNotification(new CommentReplyMessage(user, model, comment.getContent()));
}
});
}
Aggregations